From 2c976407e5e84becd2b3cc85eccbd3de04ac7f56 Mon Sep 17 00:00:00 2001 From: Mort Yao Date: Sun, 23 Jun 2024 17:42:54 +0200 Subject: [PATCH] [youtube] show subreason if possible --- src/you_get/extractors/youtube.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/you_get/extractors/youtube.py b/src/you_get/extractors/youtube.py index 1d370ec2..a76e0d2e 100644 --- a/src/you_get/extractors/youtube.py +++ b/src/you_get/extractors/youtube.py @@ -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']