mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-22 05:58:14 +00:00
chore(ytmusic): simplify home feed
This commit is contained in:
@@ -8,8 +8,12 @@ class MusicCarouselShelf {
|
||||
constructor(data) {
|
||||
this.header = Parser.parse(data.header);
|
||||
this.contents = Parser.parse(data.contents);
|
||||
this.item_size = data.itemSize || null;
|
||||
this.num_items_per_column = data.numItemsPerColumn || null;
|
||||
|
||||
data.itemSize &&
|
||||
(this.item_size = data.itemSize);
|
||||
|
||||
data.numItemsPerColumn &&
|
||||
(this.num_items_per_column = data.numItemsPerColumn);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,15 +18,11 @@ class HomeFeed {
|
||||
this.#page = Parser.parseResponse(response.data);
|
||||
|
||||
const tab = this.#page.contents.tabs.get({ title: 'Home' });
|
||||
const section_list = tab.content?.contents || this.#page.continuation_contents.contents;
|
||||
|
||||
this.#continuation = tab.content?.continuation || this.#page.continuation_contents.continuation;
|
||||
|
||||
/** @type {{ sections: { header: import('../contents/classes/MusicCarouselShelfBasicHeader'), items: object[] }[] }} */
|
||||
this.sections = observe(section_list.map((shelf) => ({
|
||||
header: shelf.header,
|
||||
items: shelf.contents
|
||||
})));
|
||||
/** @type {import('../contents/classes/MusicCarouselShelf')[]} */
|
||||
this.sections = tab.content?.contents || this.#page.continuation_contents.contents;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user