mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-07-03 09:35:05 +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 {
|
export default class ThumbnailBadgeView extends YTNode {
|
||||||
static type = 'ThumbnailBadgeView';
|
static type = 'ThumbnailBadgeView';
|
||||||
|
|
||||||
icon_name: string;
|
icon_name?: string;
|
||||||
text: string;
|
text: string;
|
||||||
badge_style: string;
|
badge_style: string;
|
||||||
background_color?: {
|
background_color?: {
|
||||||
@@ -15,14 +15,18 @@ export default class ThumbnailBadgeView extends YTNode {
|
|||||||
constructor(data: RawNode) {
|
constructor(data: RawNode) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
this.icon_name = data.icon.sources[0].clientResource.imageName;
|
|
||||||
this.text = data.text;
|
this.text = data.text;
|
||||||
this.badge_style = data.badgeStyle;
|
this.badge_style = data.badgeStyle;
|
||||||
|
|
||||||
if (data.backgroundColor) {
|
if (data.backgroundColor) {
|
||||||
this.background_color = {
|
this.background_color = {
|
||||||
light_theme: data.backgroundColor.lightTheme,
|
light_theme: data.backgroundColor.lightTheme,
|
||||||
dark_theme: data.backgroundColor.darkTheme
|
dark_theme: data.backgroundColor.darkTheme
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (data.iconName) {
|
||||||
|
this.icon_name = data.icon.sources[0].clientResource.imageName;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user