Files
YouTube.js/src/parser/classes/ItemSection.ts
Daniel Wykerd b13bf6e992 refactor(Parser)!: general refactoring of parsers (#344)
* 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
2023-03-15 18:25:12 -03:00

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;