From 173aec65f5189e9e142d63507f0de763c8bc29dc Mon Sep 17 00:00:00 2001 From: Patrick Kan <55383971+patrickkfkan@users.noreply.github.com> Date: Mon, 29 Aug 2022 02:50:00 +0800 Subject: [PATCH] fix: `Music#Artist`parse err if missing shelves (#155) --- src/parser/ytmusic/Artist.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/parser/ytmusic/Artist.ts b/src/parser/ytmusic/Artist.ts index 7491e983..c33137c3 100644 --- a/src/parser/ytmusic/Artist.ts +++ b/src/parser/ytmusic/Artist.ts @@ -20,8 +20,8 @@ class Artist { this.header = this.page.header.item().as(MusicImmersiveHeader); - const music_shelf = this.#page.contents_memo.get('MusicShelf') as MusicShelf[]; - const music_carousel_shelf = this.#page.contents_memo.get('MusicCarouselShelf') as MusicCarouselShelf[]; + const music_shelf = this.#page.contents_memo.get('MusicShelf') as MusicShelf[] || []; + const music_carousel_shelf = this.#page.contents_memo.get('MusicCarouselShelf') as MusicCarouselShelf[] || []; this.sections = [ ...music_shelf, ...music_carousel_shelf ]; }