Merge pull request 'Patched errors on too-few results' (#1) from zer0t3ch/telegram-music-bot:zer0t3ch-patch-rescount into master

Reviewed-on: david/telegram-music-bot#1
This commit is contained in:
David Daily 2021-05-14 18:56:11 -05:00
commit 1dca96d8f1

2
music.py Executable file → Normal file
View File

@ -54,7 +54,7 @@ def inlinequery(update, context: CallbackContext):
if query: if query:
sp_info = sp.search(q=query, limit=num_results) sp_info = sp.search(q=query, limit=num_results)
for i in range(num_results): for i in range(len(sp_info)):
sp_title = util.get(sp_info, f"/tracks/items/[{i}]/name") sp_title = util.get(sp_info, f"/tracks/items/[{i}]/name")
sp_artist = util.get(sp_info, f"/tracks/items/[{i}]/artists/[0]/name") sp_artist = util.get(sp_info, f"/tracks/items/[{i}]/artists/[0]/name")
sp_albname = util.get(sp_info, f"/tracks/items/[{i}]/album/name") sp_albname = util.get(sp_info, f"/tracks/items/[{i}]/album/name")