mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-24 07:11:48 +00:00
* refactor: move common info into MediaInfo * refactor: better inference on Memo * refactor: improved typesafety in parser methods * refactor: remove PlaylistAuthor in favor of Author * refactor: cleanup live chat parsers - Replace non standard author type with Author class - Remove redundant code * fix: new errors due to changes * fix: pass actions to FormatUtils#toDash * refactor!: merge NavigatableText and Text into single class
49 lines
1.3 KiB
TypeScript
49 lines
1.3 KiB
TypeScript
import Parser from '../index.js';
|
|
import Text from './misc/Text.js';
|
|
import NavigationEndpoint from './NavigationEndpoint.js';
|
|
import MusicResponsiveListItem from './MusicResponsiveListItem.js';
|
|
|
|
import { YTNode } from '../helpers.js';
|
|
import Button from './Button.js';
|
|
|
|
class MusicShelf extends YTNode {
|
|
static type = 'MusicShelf';
|
|
|
|
title: Text;
|
|
contents;
|
|
endpoint?: NavigationEndpoint;
|
|
continuation?: string;
|
|
bottom_text?: Text;
|
|
bottom_button?: Button | null;
|
|
subheaders?: Array<any>;
|
|
|
|
constructor(data: any) {
|
|
super();
|
|
this.title = new Text(data.title);
|
|
this.contents = Parser.parseArray<MusicResponsiveListItem>(data.contents, MusicResponsiveListItem);
|
|
|
|
if (data.bottomEndpoint) {
|
|
this.endpoint = new NavigationEndpoint(data.bottomEndpoint);
|
|
}
|
|
|
|
if (data.continuations) {
|
|
this.continuation =
|
|
data.continuations?.[0].nextContinuationData?.continuation ||
|
|
data.continuations?.[0].reloadContinuationData?.continuation;
|
|
}
|
|
|
|
if (data.bottomText) {
|
|
this.bottom_text = new Text(data.bottomText);
|
|
}
|
|
|
|
if (data.bottomButton) {
|
|
this.bottom_button = Parser.parseItem(data.bottomButton, Button);
|
|
}
|
|
|
|
if (data.subheaders) {
|
|
this.subheaders = Parser.parseArray(data.subheaders);
|
|
}
|
|
}
|
|
}
|
|
|
|
export default MusicShelf; |