fix(VideoInfo): Fix like count being undefined (#787)

This commit is contained in:
absidue
2024-10-28 20:08:11 +01:00
committed by GitHub
parent dba0be7bc8
commit 182bf42d3c
2 changed files with 6 additions and 3 deletions

View File

@@ -3,18 +3,20 @@ import type { ObservedArray } from '../../helpers.js';
import { YTNode } from '../../helpers.js';
import type { RawNode } from '../../index.js';
import Button from '../Button.js';
import ButtonView from '../ButtonView.js';
import SegmentedLikeDislikeButtonView from '../SegmentedLikeDislikeButtonView.js';
export default class Menu extends YTNode {
static type = 'Menu';
items: ObservedArray<YTNode>;
top_level_buttons: ObservedArray<Button>;
top_level_buttons: ObservedArray<Button | ButtonView | SegmentedLikeDislikeButtonView>;
label?: string;
constructor(data: RawNode) {
super();
this.items = Parser.parseArray(data.items);
this.top_level_buttons = Parser.parseArray(data.topLevelButtons, Button);
this.top_level_buttons = Parser.parseArray(data.topLevelButtons, [ Button, ButtonView, SegmentedLikeDislikeButtonView ]);
if (Reflect.has(data, 'accessibility') && Reflect.has(data.accessibility, 'accessibilityData')) {
this.label = data.accessibility.accessibilityData.label;