mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-19 04:21:35 +00:00
fix(music#Library): sort_by err when items <= 1 (#137)
This commit is contained in:
@@ -124,6 +124,9 @@ class Library {
|
||||
|
||||
if (shuffle) {
|
||||
if (!shuffle_endpoint) {
|
||||
if (data.items.length <= 1) {
|
||||
return data;
|
||||
}
|
||||
throw new InnertubeError('Unable to obtain endpoint for sort_by value \'random\'');
|
||||
}
|
||||
return this.#fetchAndParseShuffledSongs(shuffle_endpoint);
|
||||
@@ -172,6 +175,9 @@ class Library {
|
||||
(item) => item.as(DropdownItem).label === SORT_BY_TEXTS[sort_by])?.as(DropdownItem);
|
||||
|
||||
if (!dropdownItem?.endpoint?.browse) {
|
||||
if (data.items.length <= 1) {
|
||||
return data;
|
||||
}
|
||||
throw new InnertubeError(`Unable to obtain browse endpoint for sort_by value '${sort_by}'`);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user