mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-25 15:52:13 +00:00
fix(ytmusic): check if id is valid before proceeding
This commit is contained in:
@@ -73,6 +73,7 @@ class Music {
|
||||
* @returns {Promise.<Artist>}
|
||||
*/
|
||||
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.<Album>}
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user