Skip to content

Commit 8b432dd

Browse files
Merge pull request #215 from realkalashnikov/fix/spotify-search
fix(spotify): use search.maxResults configuration for search limit
2 parents 9a56ca8 + 8e30535 commit 8b432dd

1 file changed

Lines changed: 1 addition & 8 deletions

File tree

src/sources/spotify.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -777,14 +777,7 @@ export default class SpotifySource implements SourceInstance {
777777
return this.getRecommendations(query)
778778

779779
try {
780-
let limit = this.config.playlistLoadLimit || 10
781-
782-
// fixes the error Argument <limit> for field /searchV2 cannot be greater than 1000
783-
// this is a config issue from the user side, but if this can be used as a workaround,
784-
// we set it to 10 to avoid the error :p.
785-
if (limit > 999) {
786-
limit = 10
787-
}
780+
let limit = Math.min(Math.max(this.nodelink.options.search.maxResults ?? 10, 1), 50)
788781

789782
// Priority 1: Internal Search (Rich nodes + Local matching)
790783
if (this.anonymousToken || this.config.sp_dc) {

0 commit comments

Comments
 (0)