fix(YouTube): fix warnings when retrieving members-only content (#341)

This commit is contained in:
LuanRT
2023-03-07 05:15:46 -03:00
committed by GitHub
parent a511608f18
commit 95f1d4077f
3 changed files with 37 additions and 7 deletions

View File

@@ -0,0 +1,21 @@
import { YTNode } from '../helpers.js';
import type { RawNode } from '../index.js';
class PlayerLegacyDesktopYpcOffer extends YTNode {
static type = 'PlayerLegacyDesktopYpcOffer';
title: string;
thumbnail: string;
offer_description: string;
offer_id: string;
constructor(data: RawNode) {
super();
this.title = data.itemTitle;
this.thumbnail = data.itemThumbnail;
this.offer_description = data.offerDescription;
this.offer_id = data.offerId;
}
}
export default PlayerLegacyDesktopYpcOffer;

View File

@@ -1,7 +1,9 @@
import { YTNode } from '../helpers.js';
import type { RawNode } from '../index.js';
import type { ObservedArray } from '../helpers.js';
import { YTNodes } from '../index.js';
import Parser from '../index.js';
import Text from './misc/Text.js';
import { YTNode } from '../helpers.js';
import Menu from './menus/Menu.js';
class VideoPrimaryInfo extends YTNode {
static type = 'VideoPrimaryInfo';
@@ -10,17 +12,21 @@ class VideoPrimaryInfo extends YTNode {
super_title_link: Text;
view_count: Text;
short_view_count: Text;
badges: ObservedArray<YTNodes.MetadataBadge>;
published: Text;
menu;
relative_date: Text;
menu: YTNodes.Menu | null;
constructor(data: any) {
constructor(data: RawNode) {
super();
this.title = new Text(data.title);
this.super_title_link = new Text(data.superTitleLink);
this.view_count = new Text(data.viewCount.videoViewCountRenderer.viewCount);
this.short_view_count = new Text(data.viewCount.videoViewCountRenderer.shortViewCount);
this.view_count = new Text(data.viewCount?.videoViewCountRenderer?.viewCount);
this.short_view_count = new Text(data.viewCount?.videoViewCountRenderer?.shortViewCount);
this.badges = Parser.parseArray(data.badges, YTNodes.MetadataBadge);
this.published = new Text(data.dateText);
this.menu = Parser.parseItem(data.videoActions, Menu);
this.relative_date = new Text(data.relativeDateText);
this.menu = Parser.parseItem(data.videoActions, YTNodes.Menu);
}
}