fix: incorrect node parser implementations (#428)

These were causing some issues in v5.2.0.
This commit is contained in:
LuanRT
2023-07-03 21:58:00 -03:00
committed by GitHub
parent 83cbfd631b
commit 222dfce6bb
13 changed files with 131 additions and 78 deletions

View File

@@ -1,7 +1,6 @@
import { type ObservedArray, YTNode } from '../helpers.js';
import { YTNode, type ObservedArray } from '../helpers.js';
import Parser, { type RawNode } from '../index.js';
import { Text } from '../misc.js';
import type { Thumbnail } from '../misc.js';
import { Text, Thumbnail } from '../misc.js';
import Factoid from './Factoid.js';
import NavigationEndpoint from './NavigationEndpoint.js';
@@ -10,7 +9,7 @@ export default class VideoDescriptionHeader extends YTNode {
channel: Text;
channel_navigation_endpoint?: NavigationEndpoint;
channel_thumbnails: String[];
channel_thumbnail: Thumbnail[];
factoids: ObservedArray<Factoid>;
publish_date: Text;
title: Text;
@@ -20,8 +19,8 @@ export default class VideoDescriptionHeader extends YTNode {
super();
this.title = new Text(data.title);
this.channel = new Text(data.channel);
this.channel_navigation_endpoint = Parser.parseItem(data.channelNavigationEndpoint, NavigationEndpoint) || undefined;
this.channel_thumbnails = data.channelThumbnail.thumbnails.map((thumbnail: Thumbnail) => thumbnail.url);
this.channel_navigation_endpoint = new NavigationEndpoint(data.channelNavigationEndpoint);
this.channel_thumbnail = Thumbnail.fromResponse(data.channelThumbnail);
this.publish_date = new Text(data.publishDate);
this.views = new Text(data.views);
this.factoids = Parser.parseArray(data.factoid, Factoid);