fallback if we can't find anything on youtube

This commit is contained in:
Erin 2018-02-25 20:04:39 -06:00
parent c450828721
commit 4113baa3e1

View file

@ -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 = '''\