From 4113baa3e18d55db8e62a6fe34198aa8310ebe1e Mon Sep 17 00:00:00 2001 From: Erin Date: Sun, 25 Feb 2018 20:04:39 -0600 Subject: [PATCH] fallback if we can't find anything on youtube --- nowplaying.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nowplaying.py b/nowplaying.py index 1cfe26d..bae1979 100644 --- a/nowplaying.py +++ b/nowplaying.py @@ -46,7 +46,10 @@ class NowplayingBot(PineappleBot): # 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_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 post_template = '''\