mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-18 20:12:12 +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
31 lines
958 B
TypeScript
31 lines
958 B
TypeScript
import Parser from '../index.js';
|
|
import ItemSectionHeader from './ItemSectionHeader.js';
|
|
|
|
import { YTNode } from '../helpers.js';
|
|
import ItemSectionTabbedHeader from './ItemSectionTabbedHeader.js';
|
|
import CommentsHeader from './comments/CommentsHeader.js';
|
|
|
|
class ItemSection extends YTNode {
|
|
static type = 'ItemSection';
|
|
|
|
header: CommentsHeader | ItemSectionHeader | ItemSectionTabbedHeader | null;
|
|
contents;
|
|
target_id?: string;
|
|
continuation?: string;
|
|
|
|
constructor(data: any) {
|
|
super();
|
|
this.header = Parser.parseItem(data.header, [ CommentsHeader, ItemSectionHeader, ItemSectionTabbedHeader ]);
|
|
this.contents = Parser.parse(data.contents, true);
|
|
|
|
if (data.targetId || data.sectionIdentifier) {
|
|
this.target_id = data?.target_id || data?.sectionIdentifier;
|
|
}
|
|
|
|
if (data.continuations) {
|
|
this.continuation = data.continuations?.at(0)?.nextContinuationData?.continuation;
|
|
}
|
|
}
|
|
}
|
|
|
|
export default ItemSection; |