media-api
TypeScript icon, indicating that this package has built-in type declarations

0.0.11 • Public • Published

media-api

Unofficial API for multimedia websites. (node.js only)

workflow npm npm NPM

Quickstart:

npm install media-api
# or:
yarn add media-api
import { YouTube } from 'media-api';

async function example() {
  const youtube = new YouTube();
  const content = await youtube.content('jNQXAC9IVRw');
  console.log(content);
}

Supported media websites:

Title Content Playlist Search
YouTube ✔️ ✔️ Partial
SoundCloud Partial

Usage

All classes implement the Service interface:

export interface Service {
  content(id: string): Promise<Content>;
  playlist?(id: string): Promise<Playlist>;
  search?(text: string): Promise<SearchResults>;
}

The Content interface is defined here. This is the shortened representation of it:

export interface Content {
  id: string;
  type: ContentType;
  title: string;
  description?: string;
  duration?: number;
  statistics?: ContentStatistics;
  streams?: ContentStream[];
  thumbnails?: Thumbnail[];
  keywords?: string[];
  author?: Author;
  date?: Date;
}

The Playlist interface is defined here. This is the shortened representation of it:

export interface Playlist {
  id: string;
  title: string;
  thumbnails?: Thumbnail[];
  author?: Author;
  contents?: Content[];
}

The SearchResults interface is defined here. This is the shortened representation of it:

export interface SearchResults {
  contents?: Content[];
}

Package Sidebar

Install

npm i media-api

Weekly Downloads

1

Version

0.0.11

License

BSD-3-Clause-Clear

Unpacked Size

85.6 kB

Total Files

37

Last publish

Collaborators

  • mat-sz