[youtube] show subreason if possible

This commit is contained in:
Mort Yao 2024-06-23 17:42:54 +02:00
parent 2aaf38ce23
commit 2c976407e5
No known key found for this signature in database
GPG Key ID: 07DA00CB78203251

View File

@ -206,7 +206,13 @@ class YouTube(VideoExtractor):
logging.debug('status: %s' % status)
if status != 'OK':
# If cookies are loaded, status should be OK
log.wtf('[Failed] %s (use --cookies to load cookies)' % playabilityStatus['reason'])
try:
subreason = playabilityStatus['errorScreen']['playerErrorMessageRenderer']['subreason']['runs'][0]['text']
log.e('[Error] %s (%s)' % (playabilityStatus['reason'], subreason))
except:
log.e('[Error] %s' % playabilityStatus['reason'])
log.e('View the video from a browser and export the cookies, then use --cookies to load cookies.')
exit(1)
stream_list = ytInitialPlayerResponse['streamingData']['formats']