mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-25 07:42:11 +00:00
refactor!: fix inconsistent use of SuperParsedResult
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import Parser from '../index';
|
||||
import Text from './misc/Text';
|
||||
import PlaylistPanelVideo from './PlaylistPanelVideo';
|
||||
|
||||
import { YTNode } from '../helpers';
|
||||
|
||||
class PlaylistPanel extends YTNode {
|
||||
@@ -19,7 +21,7 @@ class PlaylistPanel extends YTNode {
|
||||
super();
|
||||
this.title = data.title;
|
||||
this.title_text = new Text(data.titleText);
|
||||
this.contents = Parser.parse(data.contents);
|
||||
this.contents = Parser.parseArray<PlaylistPanelVideo>(data.contents, PlaylistPanelVideo);
|
||||
this.playlist_id = data.playlistId;
|
||||
this.is_infinite = data.isInfinite;
|
||||
this.continuation = data.continuations[0]?.nextRadioContinuationData?.continuation;
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
import Parser from '../index';
|
||||
import NavigationEndpoint from './NavigationEndpoint';
|
||||
import SectionList from './SectionList';
|
||||
import MusicQueue from './MusicQueue';
|
||||
import RichGrid from './RichGrid';
|
||||
|
||||
import { YTNode } from '../helpers';
|
||||
|
||||
class Tab extends YTNode {
|
||||
@@ -15,7 +19,7 @@ class Tab extends YTNode {
|
||||
this.title = data.title || 'N/A';
|
||||
this.selected = data.selected || false;
|
||||
this.endpoint = new NavigationEndpoint(data.endpoint);
|
||||
this.content = Parser.parse(data.content);
|
||||
this.content = Parser.parseItem<SectionList | MusicQueue | RichGrid>(data.content, [ SectionList, MusicQueue, RichGrid ]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ class Author {
|
||||
this.#nav_text = new NavigatableText(item);
|
||||
|
||||
this.id =
|
||||
this.#nav_text.runs?.[0].endpoint.browse?.id ||
|
||||
this.#nav_text.runs?.[0].endpoint?.browse?.id ||
|
||||
this.#nav_text.endpoint?.browse?.id || 'N/A';
|
||||
|
||||
this.name = this.#nav_text.text || 'N/A';
|
||||
@@ -21,8 +21,8 @@ class Author {
|
||||
this.is_verified_artist = this.badges?.some((badge) => badge.style == 'BADGE_STYLE_TYPE_VERIFIED_ARTIST') || null;
|
||||
|
||||
this.url =
|
||||
this.#nav_text.runs?.[0].endpoint.browse &&
|
||||
`${Constants.URLS.YT_BASE}${this.#nav_text.runs[0].endpoint.browse?.base_url || `/u/${this.#nav_text.runs[0].endpoint.browse?.id}`}` ||
|
||||
this.#nav_text.runs?.[0].endpoint?.browse &&
|
||||
`${Constants.URLS.YT_BASE}${this.#nav_text.runs[0].endpoint?.browse?.base_url || `/u/${this.#nav_text.runs[0].endpoint?.browse?.id}`}` ||
|
||||
`${Constants.URLS.YT_BASE}${this.#nav_text.endpoint?.browse?.base_url || `/u/${this.#nav_text.endpoint?.browse?.id}`}` ||
|
||||
null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user