Only use android URLs if encrypted; they randomly go 403

Android URLs now begin returning 403s mid playback at random.
This commit is contained in:
Jesus E 2023-05-28 21:32:37 -04:00
parent e54596f3e9
commit 9859c5485e
No known key found for this signature in database
GPG Key ID: 159C8F8BC9AED8B6

View File

@ -431,13 +431,18 @@ def extract_info(video_id, use_invidious, playlist_id=None, index=None):
# couldn't be decrypted with the base.js from the web page for some
# reason
# https://github.com/yt-dlp/yt-dlp/issues/574#issuecomment-887171136
# Update 4/26/23, these URLs will randomly start returning 403
# mid-playback and I'm not sure why
gevent.spawn(fetch_player_response, 'android', video_id)
)
gevent.joinall(tasks)
util.check_gevent_exceptions(*tasks)
info, player_response = tasks[0].value, tasks[1].value
yt_data_extract.update_with_new_urls(info, player_response)
if yt_data_extract.requires_decryption(info):
print('Encrypted. Replacing with URLs from Android client')
yt_data_extract.update_with_new_urls(info, player_response)
# Age restricted video, retry
if info['age_restricted'] or info['player_urls_missing']: