mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-19 12:31:17 +00:00
refactor: clean up parser and tests (#387)
* tests: improve coverage * refactor: clean up nodes * chore: lint * feat(parser): ignore `BrandVideoShelf` Seems to be used for ads. * feat(parser): ignore `BrandVideoSingleton` too
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import Text from './misc/Text.js';
|
||||
import NavigationEndpoint from './NavigationEndpoint.js';
|
||||
|
||||
import { YTNode } from '../helpers.js';
|
||||
import type { RawNode } from '../index.js';
|
||||
import NavigationEndpoint from './NavigationEndpoint.js';
|
||||
import Text from './misc/Text.js';
|
||||
|
||||
class SettingBoolean extends YTNode {
|
||||
export default class SettingBoolean extends YTNode {
|
||||
static type = 'SettingBoolean';
|
||||
|
||||
title?: Text;
|
||||
@@ -12,27 +12,24 @@ class SettingBoolean extends YTNode {
|
||||
disable_endpoint?: NavigationEndpoint;
|
||||
item_id: string;
|
||||
|
||||
constructor(data: any) {
|
||||
constructor(data: RawNode) {
|
||||
super();
|
||||
|
||||
if (data.title) {
|
||||
if (Reflect.has(data, 'title')) {
|
||||
this.title = new Text(data.title);
|
||||
}
|
||||
|
||||
if (data.summary) {
|
||||
if (Reflect.has(data, 'summary')) {
|
||||
this.summary = new Text(data.summary);
|
||||
}
|
||||
|
||||
if (data.enableServiceEndpoint) {
|
||||
if (Reflect.has(data, 'enableServiceEndpoint')) {
|
||||
this.enable_endpoint = new NavigationEndpoint(data.enableServiceEndpoint);
|
||||
}
|
||||
|
||||
if (data.disableServiceEndpoint) {
|
||||
if (Reflect.has(data, 'disableServiceEndpoint')) {
|
||||
this.disable_endpoint = new NavigationEndpoint(data.disableServiceEndpoint);
|
||||
}
|
||||
|
||||
this.item_id = data.itemId;
|
||||
}
|
||||
}
|
||||
|
||||
export default SettingBoolean;
|
||||
}
|
||||
Reference in New Issue
Block a user