mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-19 12:31:17 +00:00
fix(parser): The icon_name property does not always exist in ThumbnailBadgeView (#745)
This commit is contained in:
@@ -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?: {
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user