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,22 +1,21 @@
import { YTNode } from '../helpers.js';
import Parser, { RawNode } from '../index.js';
import { type ObservedArray, YTNode } from '../helpers.js';
import Parser, { type RawNode } from '../index.js';
import Author from './misc/Author.js';
import Text from './misc/Text.js';
import Thumbnail from './misc/Thumbnail.js';
import NavigationEndpoint from './NavigationEndpoint.js';
class EndScreenVideo extends YTNode {
export default class EndScreenVideo extends YTNode {
static type = 'EndScreenVideo';
id: string;
title: Text;
thumbnails: Thumbnail[];
thumbnail_overlays;
thumbnail_overlays: ObservedArray<YTNode>;
author: Author;
endpoint: NavigationEndpoint;
short_view_count: Text;
badges;
badges: ObservedArray<YTNode>;
duration: {
text: string;
seconds: number;
@@ -31,12 +30,10 @@ class EndScreenVideo extends YTNode {
this.author = new Author(data.shortBylineText, data.ownerBadges);
this.endpoint = new NavigationEndpoint(data.navigationEndpoint);
this.short_view_count = new Text(data.shortViewCountText);
this.badges = Parser.parse(data.badges);
this.badges = Parser.parseArray(data.badges);
this.duration = {
text: new Text(data.lengthText).toString(),
seconds: data.lengthInSeconds
};
}
}
export default EndScreenVideo;
}