From bb3f3cc584621c3c91f33e4b417c5777d7fda5b0 Mon Sep 17 00:00:00 2001 From: LuanRT Date: Tue, 21 Jun 2022 03:59:44 -0300 Subject: [PATCH] fix(ytmusic): check if id is valid before proceeding --- lib/core/Music.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/core/Music.js b/lib/core/Music.js index 6c561d94..e2cb14a8 100644 --- a/lib/core/Music.js +++ b/lib/core/Music.js @@ -73,6 +73,7 @@ class Music { * @returns {Promise.} */ async getArtist(artist_id) { + if (!artist_id.startsWith('UC')) throw new InnertubeError('Invalid artist id', artist_id); const response = await this.#actions.browse(artist_id, { client: 'YTMUSIC' }); return new Artist(response, this.#actions); } @@ -84,6 +85,7 @@ class Music { * @returns {Promise.} */ async getAlbum(album_id) { + if (!album_id.startsWith('MPR')) throw new InnertubeError('Invalid album id', album_id); const response = await this.#actions.browse(album_id, { client: 'YTMUSIC' }); return new Album(response, this.#actions); }