0.0.11 • Published 3 years ago

media-api v0.0.11

Weekly downloads
14
License
BSD-3-Clause-Clea...
Repository
github
Last release
3 years ago
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:

TitleContentPlaylistSearch
YouTube✔️✔️Partial
SoundCloudPartial

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[];
}
0.0.11

3 years ago

0.0.10

3 years ago

0.0.9

3 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.5

4 years ago

0.0.6

4 years ago

0.0.3

4 years ago

0.0.4

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago