diff options
author | James Taylor <28744867+user234683@users.noreply.github.com> | 2020-10-21 18:53:12 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-21 18:53:12 -0700 |
commit | aa52c7a42e9573105dfadb07981c7f5f1447ca9d (patch) | |
tree | 6bff6ae507db03e435bb04e3969ef08093f3f8d8 /youtube/watch.py | |
parent | 3b5df36b0310b751fc25f8c0b7167c659c8259de (diff) | |
parent | f01ef36a37c9112eca3f85d49622c41d68000a69 (diff) | |
download | yt-local-aa52c7a42e9573105dfadb07981c7f5f1447ca9d.tar.lz yt-local-aa52c7a42e9573105dfadb07981c7f5f1447ca9d.tar.xz yt-local-aa52c7a42e9573105dfadb07981c7f5f1447ca9d.zip |
Merge branch 'master' into add_sponsorblock
Diffstat (limited to 'youtube/watch.py')
-rw-r--r-- | youtube/watch.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/youtube/watch.py b/youtube/watch.py index 1fa952c..8ef9448 100644 --- a/youtube/watch.py +++ b/youtube/watch.py @@ -226,15 +226,19 @@ def extract_info(video_id, use_invidious, playlist_id=None, index=None): return {'error': 'Failed to parse json response'} info = yt_data_extract.extract_watch_info(polymer_json) - # age restriction bypass - if info['age_restricted']: - print('Fetching age restriction bypass page') + # request player if it's missing + # see https://github.com/user234683/youtube-local/issues/22#issuecomment-706395160 + if info['age_restricted'] or info['player_response_missing']: + if info['age_restricted']: + print('Age restricted video. Fetching get_video_info page') + else: + print('Missing player. Fetching get_video_info page') data = { 'video_id': video_id, 'eurl': 'https://youtube.googleapis.com/v/' + video_id, } url = 'https://www.youtube.com/get_video_info?' + urllib.parse.urlencode(data) - video_info_page = util.fetch_url(url, debug_name='get_video_info', report_text='Fetched age restriction bypass page').decode('utf-8') + video_info_page = util.fetch_url(url, debug_name='get_video_info', report_text='Fetched get_video_info page').decode('utf-8') yt_data_extract.update_with_age_restricted_info(info, video_info_page) # signature decryption |