mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-18 03:59:38 +00:00
30 lines
946 B
JavaScript
30 lines
946 B
JavaScript
'use strict';
|
|
|
|
const Text = require('./Text');
|
|
const Parser = require('..');
|
|
const Thumbnail = require('./Thumbnail');
|
|
const PlaylistAuthor = require('./PlaylistAuthor');
|
|
const NavigationEndpoint = require('./NavigationEndpoint');
|
|
|
|
class PlaylistVideo {
|
|
type = 'PlaylistVideo';
|
|
|
|
constructor(data) {
|
|
this.id = data.videoId;
|
|
this.index = new Text(data.index);
|
|
this.title = new Text(data.title);
|
|
this.author = new PlaylistAuthor(data.shortBylineText);
|
|
this.thumbnails = Thumbnail.fromResponse(data.thumbnail);
|
|
this.thumbnail_overlays = Parser.parse(data.thumbnailOverlays);
|
|
this.set_video_id = data?.setVideoId;
|
|
this.endpoint = new NavigationEndpoint(data.navigationEndpoint);
|
|
this.is_playable = data.isPlayable;
|
|
this.menu = Parser.parse(data.menu);
|
|
this.duration = {
|
|
text: new Text(data.lengthText).text,
|
|
seconds: parseInt(data.lengthSeconds)
|
|
};
|
|
}
|
|
}
|
|
|
|
module.exports = PlaylistVideo; |