Package Exports
- media-api
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (media-api) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
media-api
Unofficial API for multimedia websites. (node.js only)
Quickstart:
npm install media-api
# or:
yarn add media-apiimport { 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(id: 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[];
}