mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-18 20:12:12 +00:00
feat(parser): add InfoPanelContent and InfoPanelContainer nodes
These are usually used to add more context to videos that discuss misinformation. Fixes: #326
This commit is contained in:
27
src/parser/classes/InfoPanelContainer.ts
Normal file
27
src/parser/classes/InfoPanelContainer.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { YTNode } from '../helpers.js';
|
||||
import Parser, { RawNode } from '../index.js';
|
||||
import InfoPanelContent from './InfoPanelContent.js';
|
||||
import Menu from './menus/Menu.js';
|
||||
import Text from './misc/Text.js';
|
||||
|
||||
export default class InfoPanelContainer extends YTNode {
|
||||
static type = 'InfoPanelContainer';
|
||||
|
||||
icon_type?: string;
|
||||
title: Text;
|
||||
menu: Menu | null;
|
||||
content: YTNode | null;
|
||||
background: string;
|
||||
|
||||
constructor(data: RawNode) {
|
||||
super();
|
||||
this.title = new Text(data.title);
|
||||
this.menu = Parser.parseItem(data.menu, Menu);
|
||||
this.content = Parser.parseItem(data.content, InfoPanelContent);
|
||||
this.background = data.background;
|
||||
|
||||
if (data.icon?.iconType) {
|
||||
this.icon_type = data.icon.iconType;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user