chore: v5.0.0 release

This commit is contained in:
LuanRT
2023-04-29 05:15:47 +00:00
parent b19d687eed
commit 48dc99e28b
445 changed files with 4076 additions and 3578 deletions

View File

@@ -1,13 +1,13 @@
import Parser from '../index.ts';
import Parser, { type RawNode } from '../index.ts';
import { YTNode } from '../helpers.ts';
class Card extends YTNode {
export default class Card extends YTNode {
static type = 'Card';
teaser;
content;
card_id: string | null;
feature: string | null;
teaser: YTNode;
content: YTNode;
card_id?: string;
feature?: string;
cue_ranges: {
start_card_active_ms: string;
@@ -16,12 +16,18 @@ class Card extends YTNode {
icon_after_teaser_ms: string;
}[];
constructor(data: any) {
constructor(data: RawNode) {
super();
this.teaser = Parser.parseItem(data.teaser);
this.content = Parser.parseItem(data.content);
this.card_id = data.cardId || null;
this.feature = data.feature || null;
if (Reflect.has(data, 'cardId')) {
this.card_id = data.cardId;
}
if (Reflect.has(data, 'feature')) {
this.feature = data.feature;
}
this.cue_ranges = data.cueRanges.map((cr: any) => ({
start_card_active_ms: cr.startCardActiveMs,
@@ -30,6 +36,4 @@ class Card extends YTNode {
icon_after_teaser_ms: cr.iconAfterTeaserMs
}));
}
}
export default Card;
}