mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-18 20:12:12 +00:00
feat(Parser): Add AvatarStackView
This commit is contained in:
@@ -1,24 +1,28 @@
|
||||
import { YTNode } from '../helpers.js';
|
||||
import type { RawNode } from '../index.js';
|
||||
import { Text } from '../misc.js';
|
||||
import { Parser } from '../index.js';
|
||||
import AvatarStackView from './AvatarStackView.js';
|
||||
|
||||
export type MetadataRow = {
|
||||
metadata_parts?: {
|
||||
text: Text;
|
||||
avatar_stack: AvatarStackView | null;
|
||||
}[];
|
||||
};
|
||||
|
||||
export default class ContentMetadataView extends YTNode {
|
||||
static type = 'ContentMetadataView';
|
||||
|
||||
metadata_rows: MetadataRow[];
|
||||
delimiter: string;
|
||||
public metadata_rows: MetadataRow[];
|
||||
public delimiter: string;
|
||||
|
||||
constructor(data: RawNode) {
|
||||
super();
|
||||
this.metadata_rows = data.metadataRows.map((row: RawNode) => ({
|
||||
metadata_parts: row.metadataParts?.map((part: RawNode) => ({
|
||||
text: Text.fromAttributed(part.text || {})
|
||||
text: Text.fromAttributed(part.text || {}),
|
||||
avatar_stack: Parser.parseItem(part.avatarStack, AvatarStackView)
|
||||
}))
|
||||
}));
|
||||
this.delimiter = data.delimiter;
|
||||
|
||||
Reference in New Issue
Block a user