feat: bring back Video#is_live and add ExpandableMetadata (#256)

* bring back `Video#is_live`

* add ExpandableMetadata
This commit is contained in:
LuanRT
2022-12-15 19:01:42 -03:00
committed by GitHub
parent 883a023624
commit e37f42f41b
8 changed files with 127 additions and 20 deletions

View File

@@ -0,0 +1,41 @@
import Parser from '..';
import Text from './misc/Text';
import Thumbnail from './misc/Thumbnail';
import Button from './Button';
import HorizontalCardList from './HorizontalCardList';
import { YTNode } from '../helpers';
class ExpandableMetadata extends YTNode {
static type = 'ExpandableMetadata';
header: {
collapsed_title: Text;
collapsed_thumbnail: Thumbnail[];
collapsed_label: Text;
expanded_title: Text;
};
expanded_content: HorizontalCardList | null;
expand_button: Button | null;
collapse_button: Button | null;
constructor(data: any) {
super();
this.header = {
collapsed_title: new Text(data.header.collapsedTitle),
collapsed_thumbnail: Thumbnail.fromResponse(data.header.collapsedThumbnail),
collapsed_label: new Text(data.header.collapsedLabel),
expanded_title: new Text(data.header.expandedTitle)
};
this.expanded_content = Parser.parseItem<HorizontalCardList>(data.expandedContent);
this.expand_button = Parser.parseItem<Button>(data.expandButton);
this.collapse_button = Parser.parseItem<Button>(data.collapseButton);
}
}
export default ExpandableMetadata;