mirror of
https://github.com/soimort/you-get.git
synced 2025-02-03 00:33:58 +03:00
[youtube] fix for age-restricted videos, which do not contain ytplayer.config (or html5player) on web page
This commit is contained in:
parent
511098e71f
commit
6c2c29f724
@ -152,8 +152,11 @@ class YouTube(VideoExtractor):
|
||||
|
||||
# Parse video page (for DASH)
|
||||
video_page = get_content('https://www.youtube.com/watch?v=%s' % self.vid)
|
||||
ytplayer_config = json.loads(re.search('ytplayer.config\s*=\s*([^\n]+?});', video_page).group(1))
|
||||
self.html5player = 'https:' + ytplayer_config['assets']['js']
|
||||
try:
|
||||
ytplayer_config = json.loads(re.search('ytplayer.config\s*=\s*([^\n]+?});', video_page).group(1))
|
||||
self.html5player = 'https:' + ytplayer_config['assets']['js']
|
||||
except:
|
||||
self.html5player = None
|
||||
|
||||
else:
|
||||
# Parse video page instead
|
||||
@ -294,6 +297,7 @@ class YouTube(VideoExtractor):
|
||||
}
|
||||
except:
|
||||
# VEVO
|
||||
if not self.html5player: return
|
||||
self.js = get_content(self.html5player)
|
||||
if 'adaptive_fmts' in ytplayer_config['args']:
|
||||
streams = [dict([(i.split('=')[0],
|
||||
|
Loading…
Reference in New Issue
Block a user