mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-13 09:32:12 +00:00
fix: ItemSection target_id not being parsed
This commit is contained in:
@@ -12,7 +12,7 @@ class CompactVideo {
|
||||
|
||||
constructor(data) {
|
||||
this.id = data.videoId;
|
||||
this.thumbnails = Thumbnail.fromResponse(data.thumbnail);
|
||||
this.thumbnails = Thumbnail.fromResponse(data.thumbnail) || null;
|
||||
this.rich_thumbnail = data.richThumbnail && Parser.parse(data.richThumbnail);
|
||||
this.title = new Text(data.title);
|
||||
this.author = new Author(data.longBylineText, data.ownerBadges, data.channelThumbnail);
|
||||
|
||||
@@ -8,9 +8,9 @@ class ItemSection {
|
||||
constructor(data) {
|
||||
this.header = Parser.parse(data.header);
|
||||
this.contents = Parser.parse(data.contents);
|
||||
|
||||
data.targetId || data.sectionIdentifier &&
|
||||
(this.target_id = data.targetId ? data.sectionIdentifier : null);
|
||||
|
||||
(data.targetId || data.sectionIdentifier) &&
|
||||
(this.target_id = data?.target_id || data?.sectionIdentifier);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ class MovingThumbnail {
|
||||
type = 'MovingThumbnail';
|
||||
|
||||
constructor(data) {
|
||||
return data.movingThumbnailDetails.thumbnails.map((thumbnail) => new Thumbnail(thumbnail)).sort((a, b) => b.width - a.width);
|
||||
return data.movingThumbnailDetails?.thumbnails.map((thumbnail) => new Thumbnail(thumbnail)).sort((a, b) => b.width - a.width);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ class VideoInfo {
|
||||
this.#actions = actions;
|
||||
this.#player = player;
|
||||
this.#cpn = cpn;
|
||||
|
||||
|
||||
const info = Parser.parseResponse(data[0]);
|
||||
const next = Parser.parseResponse(data[1].data || {});
|
||||
|
||||
@@ -105,7 +105,7 @@ class VideoInfo {
|
||||
*/
|
||||
this.related_chip_cloud = secondary_results?.get({ type: 'RelatedChipCloud' })?.content;
|
||||
|
||||
this.watch_next_feed = secondary_results?.get({ target_id: 'watch-next-feed' })?.contents;
|
||||
this.watch_next_feed = secondary_results?.get({ type: 'ItemSection' })?.contents;
|
||||
this.#watch_next_continuation = this.watch_next_feed?.pop();
|
||||
|
||||
/**
|
||||
@@ -116,7 +116,7 @@ class VideoInfo {
|
||||
this.basic_info.like_count = this.primary_info.menu.top_level_buttons.get({ icon_type: 'LIKE' }).like_count;
|
||||
this.basic_info.is_liked = this.primary_info.menu.top_level_buttons.get({ icon_type: 'LIKE' }).is_toggled;
|
||||
this.basic_info.is_disliked = this.primary_info.menu.top_level_buttons.get({ icon_type: 'DISLIKE' }).is_toggled;
|
||||
|
||||
|
||||
const comments_entry_point = results.get({ target_id: 'comments-entry-point' });
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user