fix(ytmusic): rename old class types

This commit is contained in:
LuanRT
2022-06-15 22:28:08 -03:00
parent 4ef546b3f0
commit e8a81084e6
3 changed files with 14 additions and 9 deletions

View File

@@ -8,9 +8,14 @@ class SectionList {
constructor(data) {
this.target_id = data.targetId || null;
this.contents = Parser.parse(data.contents);
data.continuations &&
(this.continuation = data.continuations[0].nextContinuationData.continuation);
if (data.continuations) {
if (data.continuations[0].nextContinuationData) {
this.continuation = data.continuations[0].nextContinuationData.continuation;
} else if (data.continuations[0].reloadContinuationData) {
this.continuation = data.continuations[0].reloadContinuationData.continuation;
}
}
this.header = Parser.parse(data.header);
}

View File

@@ -19,8 +19,8 @@ class Library {
const tab = this.#page.contents.tabs.get({ selected: true });
const shelves = tab.content.contents.map((section) => section.contents[0]);
const stats = this.#page.contents.secondary_contents.items.get({ type: 'profileColumnStatsRenderer' }).items;
const user_info = this.#page.contents.secondary_contents.items.get({ type: 'profileColumnUserInfoRenderer' });
const stats = this.#page.contents.secondary_contents.items.get({ type: 'ProfileColumnStats' }).items;
const user_info = this.#page.contents.secondary_contents.items.get({ type: 'ProfileColumnUserInfo' });
this.profile = { stats, user_info };

View File

@@ -28,24 +28,24 @@ class Search {
const tab = this.#page.contents.tabs.get({ selected: true });
const shelves = tab.content.contents;
const item_section = shelves.get({ type: 'itemSectionRenderer' });
const item_section = shelves.get({ type: 'ItemSection' });
this.#header = tab.content.header;
/**
* @type {import('../contents/classes/DidYouMean')}
*/
this.did_you_mean = item_section?.contents.get({ type: 'didYouMeanRenderer' }) || null;
this.did_you_mean = item_section?.contents.get({ type: 'DidYouMean' }) || null;
/**
* @type {import('../contents/classes/ShowingResultsFor')}
*/
this.showing_results_for = item_section?.contents.get({ type: 'showingResultsForRenderer' }) || null;
this.showing_results_for = item_section?.contents.get({ type: 'ShowingResultsFor' }) || null;
(!!this.did_you_mean || !!this.showing_results_for) && shelves.shift();
if (args.is_continuation || args.is_filtered) {
const shelf = shelves.get({ type: 'musicShelfRenderer' });
const shelf = shelves.get({ type: 'MusicShelf' });
this.results = shelf.contents;
this.#shelf_title = shelf.title.toString();