diff --git a/src/parser/classes/CollectionThumbnailView.ts b/src/parser/classes/CollectionThumbnailView.ts index 41783701..571da853 100644 --- a/src/parser/classes/CollectionThumbnailView.ts +++ b/src/parser/classes/CollectionThumbnailView.ts @@ -6,7 +6,7 @@ export default class CollectionThumbnailView extends YTNode { static type = 'CollectionThumbnailView'; primary_thumbnail: ThumbnailView | null; - stack_color: { + stack_color?: { light_theme: number; dark_theme: number; }; @@ -15,9 +15,11 @@ export default class CollectionThumbnailView extends YTNode { super(); this.primary_thumbnail = Parser.parseItem(data.primaryThumbnail, ThumbnailView); - this.stack_color = { - light_theme: data.stackColor.lightTheme, - dark_theme: data.stackColor.darkTheme - }; + if (data.stackColor) { + this.stack_color = { + light_theme: data.stackColor.lightTheme, + dark_theme: data.stackColor.darkTheme + }; + } } } \ No newline at end of file diff --git a/src/parser/classes/ThumbnailBadgeView.ts b/src/parser/classes/ThumbnailBadgeView.ts index 2a5fb9c3..249feb49 100644 --- a/src/parser/classes/ThumbnailBadgeView.ts +++ b/src/parser/classes/ThumbnailBadgeView.ts @@ -7,7 +7,7 @@ export default class ThumbnailBadgeView extends YTNode { icon_name: string; text: string; badge_style: string; - background_color: { + background_color?: { light_theme: number; dark_theme: number; }; @@ -18,9 +18,11 @@ export default class ThumbnailBadgeView extends YTNode { this.icon_name = data.icon.sources[0].clientResource.imageName; this.text = data.text; this.badge_style = data.badgeStyle; - this.background_color = { - light_theme: data.backgroundColor.lightTheme, - dark_theme: data.backgroundColor.darkTheme - }; + if (data.backgroundColor) { + this.background_color = { + light_theme: data.backgroundColor.lightTheme, + dark_theme: data.backgroundColor.darkTheme + }; + } } } \ No newline at end of file diff --git a/src/parser/classes/ThumbnailView.ts b/src/parser/classes/ThumbnailView.ts index b768f499..bb389e3b 100644 --- a/src/parser/classes/ThumbnailView.ts +++ b/src/parser/classes/ThumbnailView.ts @@ -9,7 +9,7 @@ export default class ThumbnailView extends YTNode { image: Thumbnail[]; overlays: (ThumbnailOverlayBadgeView | ThumbnailHoverOverlayView)[]; - background_color: { + background_color?: { light_theme: number; dark_theme: number; }; @@ -19,9 +19,11 @@ export default class ThumbnailView extends YTNode { this.image = Thumbnail.fromResponse(data.image); this.overlays = Parser.parseArray(data.overlays, [ ThumbnailOverlayBadgeView, ThumbnailHoverOverlayView ]); - this.background_color = { - light_theme: data.backgroundColor.lightTheme, - dark_theme: data.backgroundColor.darkTheme - }; + if (data.backgroundColor) { + this.background_color = { + light_theme: data.backgroundColor.lightTheme, + dark_theme: data.backgroundColor.darkTheme + }; + } } } \ No newline at end of file