diff --git a/src/you_get/extractors/youtube.py b/src/you_get/extractors/youtube.py index f5aaf50e..1d370ec2 100644 --- a/src/you_get/extractors/youtube.py +++ b/src/you_get/extractors/youtube.py @@ -190,8 +190,6 @@ class YouTube(VideoExtractor): jsUrl = re.search('([^"]*/base\.js)"', video_page).group(1) except: log.wtf('[Failed] Unable to find base.js on the video page') - # FIXME: do we still need this? - jsUrl = jsUrl.replace('\/', '/') # unescape URL (for age-restricted videos) self.html5player = 'https://www.youtube.com' + jsUrl logging.debug('Retrieving the player code...') self.js = get_content(self.html5player).replace('\n', ' ') @@ -202,6 +200,14 @@ class YouTube(VideoExtractor): # Get the video title self.title = ytInitialPlayerResponse["videoDetails"]["title"] + # Check the status + playabilityStatus = ytInitialPlayerResponse['playabilityStatus'] + status = playabilityStatus['status'] + 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']) + stream_list = ytInitialPlayerResponse['streamingData']['formats'] for stream in stream_list: