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:
LuanRT
2023-04-23 06:37:33 -03:00
committed by GitHub
parent f66f0bd656
commit 257bd475a0
358 changed files with 2823 additions and 3126 deletions

View File

@@ -1,17 +1,16 @@
import Parser from '../index.js';
import Text from './misc/Text.js';
import PlaylistPanelVideo from './PlaylistPanelVideo.js';
import { YTNode } from '../helpers.js';
import { YTNode, type ObservedArray } from '../helpers.js';
import Parser, { type RawNode } from '../index.js';
import AutomixPreviewVideo from './AutomixPreviewVideo.js';
import PlaylistPanelVideo from './PlaylistPanelVideo.js';
import PlaylistPanelVideoWrapper from './PlaylistPanelVideoWrapper.js';
import Text from './misc/Text.js';
class PlaylistPanel extends YTNode {
export default class PlaylistPanel extends YTNode {
static type = 'PlaylistPanel';
title: string;
title_text: Text;
contents;
contents: ObservedArray<PlaylistPanelVideoWrapper | PlaylistPanelVideo | AutomixPreviewVideo>;
playlist_id: string;
is_infinite: boolean;
continuation: string;
@@ -19,7 +18,7 @@ class PlaylistPanel extends YTNode {
preview_description: string;
num_items_to_show: string;
constructor(data: any) {
constructor(data: RawNode) {
super();
this.title = data.title;
this.title_text = new Text(data.titleText);
@@ -31,6 +30,4 @@ class PlaylistPanel extends YTNode {
this.preview_description = data.previewDescription;
this.num_items_to_show = data.numItemsToShow;
}
}
export default PlaylistPanel;
}