Skip to content

Commit

Permalink
Merge pull request #81 from RafaelSolVargas/master
Browse files Browse the repository at this point in the history
Fix error #80
  • Loading branch information
Raptor123471 authored Dec 30, 2021
2 parents 0deaafb + 14a4566 commit 270e750
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions musicbot/audiocontroller.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,9 @@ def down(song):
if song.host == linkutils.Sites.Spotify:
song.info.webpage_url = self.search_youtube(song.info.title)

if song.info.webpage_url == None:
return None

downloader = yt_dlp.YoutubeDL(
{'format': 'bestaudio', 'title': True, "cookiefile": config.COOKIE_PATH})
r = downloader.extract_info(
Expand Down Expand Up @@ -272,6 +275,9 @@ def search_youtube(self, title):
with yt_dlp.YoutubeDL(options) as ydl:
r = ydl.extract_info(title, download=False)

if r == None:
return None

videocode = r['entries'][0]['id']

return "https://www.youtube.com/watch?v={}".format(videocode)
Expand Down

0 comments on commit 270e750

Please sign in to comment.