fallback if we can't find anything on youtube
This commit is contained in:
parent
c450828721
commit
4113baa3e1
1 changed files with 4 additions and 1 deletions
|
|
@ -46,7 +46,10 @@ class NowplayingBot(PineappleBot):
|
||||||
|
|
||||||
# make a best-effort guess at the youtube link for this track
|
# make a best-effort guess at the youtube link for this track
|
||||||
yt_search = search_youtube(str(currently_playing), key=self.config.youtube_key)
|
yt_search = search_youtube(str(currently_playing), key=self.config.youtube_key)
|
||||||
yt_link = f"https://www.youtube.com/watch?v={yt_search[0]['id']}"
|
if yt_search is not None:
|
||||||
|
yt_link = f"https://www.youtube.com/watch?v={yt_search[0]['id']}"
|
||||||
|
else:
|
||||||
|
yt_link = ':sparkler: no youtube link, sorry :sparkler:'
|
||||||
|
|
||||||
# template the post
|
# template the post
|
||||||
post_template = '''\
|
post_template = '''\
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue