diff --git a/lib/parser/contents/classes/MusicCarouselShelf.js b/lib/parser/contents/classes/MusicCarouselShelf.js index 46734051..5ff6cc58 100644 --- a/lib/parser/contents/classes/MusicCarouselShelf.js +++ b/lib/parser/contents/classes/MusicCarouselShelf.js @@ -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); } } diff --git a/lib/parser/ytmusic/HomeFeed.js b/lib/parser/ytmusic/HomeFeed.js index 9906d312..756cbe86 100644 --- a/lib/parser/ytmusic/HomeFeed.js +++ b/lib/parser/ytmusic/HomeFeed.js @@ -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; } /**