Fixes problem with audio urls

This commit is contained in:
pluja 2020-10-05 17:14:16 +02:00
parent 7711c07739
commit 8250184877
2 changed files with 6 additions and 6 deletions

View File

@ -397,8 +397,8 @@ def watch():
url = "#" url = "#"
try: try:
audioHostName = urllib.parse.urlparse(info['video']['audio']['url']) audioHostName = urllib.parse.urlparse(info['video']['audio']).netloc
audioUrl = info['video']['audio']['url'].replace("https://{}".format(audioHostName), "")+"&host="+audioHostName audioUrl = info['video']['audio'].replace("https://{}".format(audioHostName), "")+"&host="+audioHostName
except: except:
audioUrl = False audioUrl = False

View File

@ -130,7 +130,7 @@ def get_video_primary_info(datad, datai):
isLive = False isLive = False
# Check if is a Scheduled video # Check if is a Scheduled video
if details.get('isUpcoming'): if details.get('isUpcoming') == True:
isUpcoming = True isUpcoming = True
views = "Scheduled video" views = "Scheduled video"
premieres = item['dateText']['simpleText'] premieres = item['dateText']['simpleText']
@ -142,7 +142,7 @@ def get_video_primary_info(datad, datai):
ydl = YoutubeDL() ydl = YoutubeDL()
if not isUpcoming: if isUpcoming == False:
data = ydl.extract_info(details['videoId'], False) data = ydl.extract_info(details['videoId'], False)
while not data['formats']: while not data['formats']:
data = ydl.extract_info(details['videoId'], False) data = ydl.extract_info(details['videoId'], False)
@ -167,9 +167,9 @@ def get_video_primary_info(datad, datai):
except: except:
continue continue
if not isLive: if not isLive:
audioURL = audio_urls[-1] audioURL = audio_urls[-1]['url']
else: else:
audioURL = "#" audioURL = False
else: # If it is a scheduled video else: # If it is a scheduled video
audio_urls = False audio_urls = False
formats = False formats = False