mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-29 09:37:26 +00:00
* tests: improve coverage * refactor: clean up nodes * chore: lint * feat(parser): ignore `BrandVideoShelf` Seems to be used for ads. * feat(parser): ignore `BrandVideoSingleton` too
30 lines
675 B
TypeScript
30 lines
675 B
TypeScript
import { YTNode } from '../helpers.js';
|
|
import type { RawNode } from '../index.js';
|
|
|
|
export default class MetadataBadge extends YTNode {
|
|
static type = 'MetadataBadge';
|
|
|
|
icon_type?: string;
|
|
style?: string;
|
|
label?: string;
|
|
tooltip?: string;
|
|
|
|
constructor(data: RawNode) {
|
|
super();
|
|
if (Reflect.has(data, 'icon')) {
|
|
this.icon_type = data.icon.iconType;
|
|
}
|
|
|
|
if (Reflect.has(data, 'style')) {
|
|
this.style = data.style;
|
|
}
|
|
|
|
if (Reflect.has(data, 'label')) {
|
|
this.label = data.label;
|
|
}
|
|
|
|
if (Reflect.has(data, 'tooltip') || Reflect.has(data, 'iconTooltip')) {
|
|
this.tooltip = data.tooltip || data.iconTooltip;
|
|
}
|
|
}
|
|
} |