mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-14 10:02:16 +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
37 lines
1.0 KiB
TypeScript
37 lines
1.0 KiB
TypeScript
import NavigationEndpoint from './NavigationEndpoint.js';
|
|
import Text from './misc/Text.js';
|
|
import Thumbnail from './misc/Thumbnail.js';
|
|
import { YTNode } from '../helpers.js';
|
|
import type { RawNode } from '../index.js';
|
|
|
|
export default class GuideEntry extends YTNode {
|
|
static type = 'GuideEntry';
|
|
|
|
title: Text;
|
|
endpoint: NavigationEndpoint;
|
|
icon_type?: string;
|
|
thumbnails?: Thumbnail[];
|
|
badges?: any;
|
|
is_primary: boolean;
|
|
|
|
constructor(data: RawNode) {
|
|
super();
|
|
this.title = new Text(data.formattedTitle);
|
|
this.endpoint = new NavigationEndpoint(data.navigationEndpoint || data.serviceEndpoint);
|
|
|
|
if (Reflect.has(data, 'icon') && Reflect.has(data.icon, 'iconType')) {
|
|
this.icon_type = data.icon.iconType;
|
|
}
|
|
|
|
if (Reflect.has(data, 'thumbnail')) {
|
|
this.thumbnails = Thumbnail.fromResponse(data.thumbnail);
|
|
}
|
|
|
|
// (LuanRT) XXX: Check this property's data and parse it.
|
|
if (Reflect.has(data, 'badges')) {
|
|
this.badges = data.badges;
|
|
}
|
|
|
|
this.is_primary = !!data.isPrimary;
|
|
}
|
|
} |