actually fix the slowness of the YTMusic API

This commit is contained in:
David Daily 2021-02-13 00:17:41 -06:00
parent 31c3fb9ada
commit 4daa0cbbfe

View File

@ -64,8 +64,8 @@ def inlinequery(update, context: CallbackContext):
sp_link = util.get(sp_info, f"/tracks/items/[{i}]/external_urls/spotify")
songlink = "https://song.link/{0}".format(sp_link)
yt_q = f"{sp_artist} - {sp_title}"
yt_res = ytmusic.search(yt_q, 'songs', limit=1)
if yt_res == 0:
if yt_q == 0:
yt_res = ytmusic.search(yt_q, 'songs', limit=1)
yt_id = util.get(yt_res, f"[1]/videoId")
yt_link = f"https://music.youtube.com/watch?v={yt_id}"
reply_markup = InlineKeyboardMarkup([[InlineKeyboardButton("YouTube", url = yt_link), InlineKeyboardButton("Spotify", url = sp_link), InlineKeyboardButton("More", url = songlink)]])