media-api
v0.0.11
Published
Unofficial API for multimedia websites.
Downloads
16
Maintainers
Readme
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[];
}