mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-30 09:55:18 +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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user