feat: add support for topic/auto-generated channels and fix minor parsing errors (#233)

* dev: add support for topic channels

* dev(parser): do not try to parse empty nodes

* dev: add support for auto-generated game channels
This commit is contained in:
LuanRT
2022-11-11 00:38:44 -03:00
committed by GitHub
parent 4c00f15f55
commit 3cbcd71a3a
20 changed files with 325 additions and 22 deletions

View File

@@ -0,0 +1,36 @@
import Parser from '..';
import { ObservedArray, YTNode } from '../helpers';
import Text from './misc/Text';
import Thumbnail from './misc/Thumbnail';
import SubscribeButton from './SubscribeButton';
import MetadataBadge from './MetadataBadge';
import Button from './Button';
export default class InteractiveTabbedHeader extends YTNode {
static type = 'InteractiveTabbedHeader';
header_type: string;
title: Text;
description: Text;
metadata: Text;
badges: MetadataBadge[];
box_art: Thumbnail[];
banner: Thumbnail[];
buttons: ObservedArray<SubscribeButton | Button>;
auto_generated: Text;
constructor(data: any) {
super();
this.header_type = data.type;
this.title = new Text(data.title);
this.description = new Text(data.description);
this.metadata = new Text(data.metadata);
this.badges = Parser.parseArray<MetadataBadge>(data.badges, MetadataBadge);
this.box_art = Thumbnail.fromResponse(data.boxArt);
this.banner = Thumbnail.fromResponse(data.banner);
this.buttons = Parser.parseArray<SubscribeButton | Button>(data.buttons, [ SubscribeButton, Button ]);
this.auto_generated = new Text(data.autoGenerated);
}
}