diff --git a/app/routes.py b/app/routes.py index df11f13..62f3694 100644 --- a/app/routes.py +++ b/app/routes.py @@ -397,8 +397,8 @@ def watch(): url = "#" try: - audioHostName = urllib.parse.urlparse(info['video']['audio']['url']) - audioUrl = info['video']['audio']['url'].replace("https://{}".format(audioHostName), "")+"&host="+audioHostName + audioHostName = urllib.parse.urlparse(info['video']['audio']).netloc + audioUrl = info['video']['audio'].replace("https://{}".format(audioHostName), "")+"&host="+audioHostName except: audioUrl = False diff --git a/youtube_data/videos.py b/youtube_data/videos.py index 15b4111..feda8aa 100644 --- a/youtube_data/videos.py +++ b/youtube_data/videos.py @@ -130,7 +130,7 @@ def get_video_primary_info(datad, datai): isLive = False # Check if is a Scheduled video - if details.get('isUpcoming'): + if details.get('isUpcoming') == True: isUpcoming = True views = "Scheduled video" premieres = item['dateText']['simpleText'] @@ -142,7 +142,7 @@ def get_video_primary_info(datad, datai): ydl = YoutubeDL() - if not isUpcoming: + if isUpcoming == False: data = ydl.extract_info(details['videoId'], False) while not data['formats']: data = ydl.extract_info(details['videoId'], False) @@ -167,9 +167,9 @@ def get_video_primary_info(datad, datai): except: continue if not isLive: - audioURL = audio_urls[-1] + audioURL = audio_urls[-1]['url'] else: - audioURL = "#" + audioURL = False else: # If it is a scheduled video audio_urls = False formats = False