Skip to content

Commit

Permalink
fix(parser): The icon_name property does not always exist in Thumbnai…
Browse files Browse the repository at this point in the history
…lBadgeView (#745)
  • Loading branch information
absidue authored Sep 11, 2024
1 parent 4fca6c3 commit 094a96f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/parser/classes/ThumbnailBadgeView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { RawNode } from '../index.js';
export default class ThumbnailBadgeView extends YTNode {
static type = 'ThumbnailBadgeView';

icon_name: string;
icon_name?: string;
text: string;
badge_style: string;
background_color?: {
Expand All @@ -15,14 +15,18 @@ export default class ThumbnailBadgeView extends YTNode {
constructor(data: RawNode) {
super();

this.icon_name = data.icon.sources[0].clientResource.imageName;
this.text = data.text;
this.badge_style = data.badgeStyle;

if (data.backgroundColor) {
this.background_color = {
light_theme: data.backgroundColor.lightTheme,
dark_theme: data.backgroundColor.darkTheme
};
}

if (data.iconName) {
this.icon_name = data.icon.sources[0].clientResource.imageName;
}
}
}

0 comments on commit 094a96f

Please sign in to comment.