diff options
author | James Taylor <user234683@users.noreply.github.com> | 2020-12-21 17:35:21 -0800 |
---|---|---|
committer | Jesús <heckyel@hyperbola.info> | 2020-12-21 21:28:43 -0500 |
commit | 6f4963cbfb3b49922f5704e18172047b76c5c4e0 (patch) | |
tree | 17be1e565f25cabf6d801661c2f09a640264cb1d /youtube | |
parent | dcfa2700efcd876c1853c1cf0b08fa7c391a3329 (diff) | |
download | yt-local-6f4963cbfb3b49922f5704e18172047b76c5c4e0.tar.lz yt-local-6f4963cbfb3b49922f5704e18172047b76c5c4e0.tar.xz yt-local-6f4963cbfb3b49922f5704e18172047b76c5c4e0.zip |
Include watch_headers in get_video_info so error lang is english
e.g. if the error in get_video_info is "Video unavailable" must
include the Accept-Language header (which we have in watch_headers)
in order to get an English error message. Otherwise we get the
language of the Tor exit node region
Example: https://youtu.be/aaaaaaaaaaa
Signed-off-by: Jesús <heckyel@hyperbola.info>
Diffstat (limited to 'youtube')
-rw-r--r-- | youtube/watch.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/youtube/watch.py b/youtube/watch.py index 78a404a..5d9f16c 100644 --- a/youtube/watch.py +++ b/youtube/watch.py @@ -241,7 +241,9 @@ def extract_info(video_id, use_invidious, playlist_id=None, index=None): '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 get_video_info page').decode('utf-8') + video_info_page = util.fetch_url( + url, headers=watch_headers, 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 |