Skip to content

Commit

Permalink
[youtube] show subreason if possible
Browse files Browse the repository at this point in the history
  • Loading branch information
soimort committed Jun 23, 2024
1 parent 2aaf38c commit 2c97640
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/you_get/extractors/youtube.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,13 @@ def prepare(self, **kwargs):
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']

Expand Down

0 comments on commit 2c97640

Please sign in to comment.