-
Notifications
You must be signed in to change notification settings - Fork 14
Playlist
const playlist = ytcog.Playlist(session, playlistOptions);
session is an instance of a ytcog.Session
playlistOptions is a user defined object explained below
fetch() initiates the collection of metadata/results. fetch() provides the opportunity to change playlist options prior to execution. fetch() will continue to fetch results until it matches or exceeds the desired quantity of results or there are no more results to collect.
playlist.fetch([playlistOptions]);
continued() must be preceded by a fetch() method. continued() will fetch extra results. It can be called repeatedly.
playlist.continued();
Playlist objects can have the following properties. Playlist objects created from results, in particular, may have many properties undefined, giving only default values until such time as a playlist.fetch() is performed on it.
playlist.status (string) The result of the last fetch(), continued() or download(): Either OK, NOK or ERROR
playlist.reason (string) The reason for status NOK or ERROR. Can report 'No results'.
playlist.updated (number) Timestamp of last fetch.
playlist.data (string) or [(string)] The raw YouTube data fetched.
playlist.transferred (number) Cumulative number of bytes of incoming data (compressed with gzip library).
playlist.debugOn (boolean) default is false. Set to true to get error information in the console.
playlist.results ([Item]) Array of objects fetched by the last fetch()/continued() cycle.
playlist.videos ([Video]) Array of video objects fetched by fetch() and continued() methods.
playlist.videoCount (number) Number of videos in the playlist (if known, -1 if unknown).
playlist.views (number) Number of playlist views
playlist.compiler (string) Displayed name of channel owned by the playlist compiler
playlist.published (number) Timestamp of when playlist was last updated by the compiler
playlist.channelId (string) Channel Id of playlist compiler
playlist.channelThumb (string) Url of logo of playlist compiler
playlist.thumbnail (string) Thumbnail url of the playlist logo
playlist.page (number) Last page number of raw data collected on the last fetch()/continued() cycle.
playlistOptions is an object with the following properties:
An object with the following properties:
id: (34 character string commencing with 'PL') the playlist id. Required in constructor.
Can be omitted in subsequent option updates.
quantity: (number) the desired number of videos. If available the actual number of results will
match or exceed this number. (default: 100)
{
id: 'PLQ_voP4Q3cffatM_zKUO5-woz34KyLrPL',
quantity: 300
}