diff --git a/lib/core/VideoInfo.js b/lib/core/VideoInfo.js index 22dbc18b..54b60b00 100644 --- a/lib/core/VideoInfo.js +++ b/lib/core/VideoInfo.js @@ -81,6 +81,11 @@ class VideoInfo { * @type {import('../parser/contents/classes/Endscreen')} */ this.endscreen = info.endscreen; + + /** + * @type {import('../parser/contents/classes/PlayerCaptionsTracklist')} + */ + this.captions = info.captions; /** * @type {import('../parser/contents/classes/CardCollection')} diff --git a/lib/parser/contents/classes/Author.js b/lib/parser/contents/classes/Author.js index fe6d3fde..6b5e0b61 100644 --- a/lib/parser/contents/classes/Author.js +++ b/lib/parser/contents/classes/Author.js @@ -15,8 +15,8 @@ class Author { this.endpoint = nav_text.runs[0].endpoint; this.badges = badges || []; - this.is_verified = badges?.some((badge) => badge.style == 'BADGE_STYLE_TYPE_VERIFIED') || false; - this.is_verified_artist = badges?.some((badge) => badge.style == 'BADGE_STYLE_TYPE_VERIFIED_ARTIST') || false; + this.is_verified = badges?.some((badge) => badge.style == 'BADGE_STYLE_TYPE_VERIFIED') || null; + this.is_verified_artist = badges?.some((badge) => badge.style == 'BADGE_STYLE_TYPE_VERIFIED_ARTIST') || null; } } diff --git a/lib/parser/contents/classes/CommentsEntryPointHeader.js b/lib/parser/contents/classes/CommentsEntryPointHeader.js index 7c68e4a1..632c07f2 100644 --- a/lib/parser/contents/classes/CommentsEntryPointHeader.js +++ b/lib/parser/contents/classes/CommentsEntryPointHeader.js @@ -9,8 +9,8 @@ class CommentsEntryPointHeader { constructor(data) { this.header = new Text(data.headerText); this.comment_count = new Text(data.commentCount); - this.teaser_avatar = new Thumbnail(data.teaserAvatar).thumbnails; - this.teaser_content = new Text(data.teaserContent); + this.teaser_avatar = new Thumbnail(data.teaserAvatar || data.simpleboxAvatar).thumbnails; + this.teaser_content = new Text(data.simpleboxPlaceholder); } } diff --git a/lib/parser/contents/classes/PlayerCaptionsTracklist.js b/lib/parser/contents/classes/PlayerCaptionsTracklist.js new file mode 100644 index 00000000..e6c986d2 --- /dev/null +++ b/lib/parser/contents/classes/PlayerCaptionsTracklist.js @@ -0,0 +1,29 @@ +'use strict'; + +const Text = require('./Text'); + +class PlayerCaptionsTracklist { + type = 'playerCaptionsTracklistRenderer' + + constructor(data) { + this.caption_tracks = data.captionTracks.map((ct) => ({ + base_url: ct.baseUrl, + name: new Text(ct.name), + vss_id: ct.vssId, + language_code: ct.languageCode, + kind: ct.kind, + is_translatable: ct.isTranslatable + })); + + this.audio_tracks = data.audioTracks.map((at) => ({ + caption_track_indices: at.captionTrackIndices + })); + + this.translation_languages = data.translationLanguages.map((tl) => ({ + language_code: tl.languageCode, + language_name: new Text(tl.languageName) + })); + } +} + +module.exports = PlayerCaptionsTracklist; \ No newline at end of file diff --git a/lib/parser/contents/classes/VideoDetails.js b/lib/parser/contents/classes/VideoDetails.js index f4fc3598..ee982614 100644 --- a/lib/parser/contents/classes/VideoDetails.js +++ b/lib/parser/contents/classes/VideoDetails.js @@ -7,7 +7,7 @@ class VideoDetails { this.id = data.videoId; this.title = data.title; this.duration = parseInt(data.lengthSeconds); - this.keywords = data.keywords; + this.keywords = data.keywords || []; this.channel_id = data.channelId; this.is_owner_viewing = data.isOwnerViewing; this.description = data.shortDescription;