@sushibtw/youtubei
Version:
Simple package to get information from youtube such as videos, playlists, channels, video information & comments, related videos, up next video, and more!
62 lines (61 loc) • 2.06 kB
TypeScript
import { BaseAttributes, VideoCompact, Channel, Base } from ".";
import { YoutubeRawData } from "../common";
/** @hidden */
interface PlaylistAttributes extends BaseAttributes {
title: string;
videoCount: number;
viewCount: number;
lastUpdatedAt: string;
channel?: Channel;
videos: VideoCompact[];
}
/** Represents a Playlist, usually returned from `client.getPlaylist()` */
export default class Playlist extends Base implements PlaylistAttributes {
/** The title of this playlist */
title: string;
/** How many videos in this playlist */
videoCount: number;
/** How many viewers does this playlist have */
viewCount: number;
/** Last time this playlist is updated */
lastUpdatedAt: string;
/** The channel that made this playlist */
channel?: Channel;
/** Videos in the playlist */
videos: VideoCompact[];
private _continuation;
/** @hidden */
constructor(playlist?: Partial<Playlist>);
/**
* Load this instance with raw data from Youtube
*
* @hidden
*/
load(data: YoutubeRawData): Playlist;
/**
* Load next 100 videos of the playlist, and push the loaded videos to {@link Playlist.videos}
*
* @example
* ```js
* const playlist = await youtube.getPlaylist(PLAYLIST_ID);
* console.log(playlist.videos) // first 100 videos
*
* let newVideos = await playlist.next();
* console.log(newVideos) // 100 loaded videos
* console.log(playlist.videos) // first 200 videos
*
* await playlist.next(0); // load the rest of the videos in the playlist
* ```
*
* @param count How many times to load the next videos. Set 0 to load all videos (might take a while on a large playlist!)
*/
next(count?: number): Promise<VideoCompact[]>;
/**
* Get compact videos
*
* @param playlistContents raw object from youtubei
*/
private static parseVideos;
private static parseSideBarInfo;
}
export {};