diff options
author | Jesus E <heckyel@riseup.net> | 2023-05-28 21:32:37 -0400 |
---|---|---|
committer | Jesus E <heckyel@riseup.net> | 2023-05-28 21:32:37 -0400 |
commit | 9859c5485e09b5593a3abcf41222ef5bdd7bc159 (patch) | |
tree | 974cae3f024057a6a0c9e0f2193920f6f61b8506 | |
parent | e54596f3e9bac1b5ef328b25e44604aa11479f83 (diff) | |
download | yt-local-9859c5485e09b5593a3abcf41222ef5bdd7bc159.tar.lz yt-local-9859c5485e09b5593a3abcf41222ef5bdd7bc159.tar.xz yt-local-9859c5485e09b5593a3abcf41222ef5bdd7bc159.zip |
Only use android URLs if encrypted; they randomly go 403
Android URLs now begin returning 403s mid playback at random.
-rw-r--r-- | youtube/watch.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/youtube/watch.py b/youtube/watch.py index c38a3f5..46cfdf5 100644 --- a/youtube/watch.py +++ b/youtube/watch.py @@ -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']: |