all requests use a accept-language: en-us header now

This commit is contained in:
Jonas Depoix 2023-06-16 15:11:26 +02:00
parent 7da50a716b
commit b4e9cfc35b
1 changed files with 2 additions and 2 deletions

View File

@ -88,7 +88,7 @@ class TranscriptListFetcher(object):
return html return html
def _fetch_html(self, video_id): def _fetch_html(self, video_id):
response = self._http_client.get(WATCH_URL.format(video_id=video_id)) response = self._http_client.get(WATCH_URL.format(video_id=video_id), headers={'Accept-Language': 'en-US'})
return unescape(_raise_http_errors(response, video_id).text) return unescape(_raise_http_errors(response, video_id).text)
@ -288,7 +288,7 @@ class Transcript(object):
:return: a list of dictionaries containing the 'text', 'start' and 'duration' keys :return: a list of dictionaries containing the 'text', 'start' and 'duration' keys
:rtype [{'text': str, 'start': float, 'end': float}]: :rtype [{'text': str, 'start': float, 'end': float}]:
""" """
response = self._http_client.get(self._url) response = self._http_client.get(self._url, headers={'Accept-Language': 'en-US'})
return _TranscriptParser(preserve_formatting=preserve_formatting).parse( return _TranscriptParser(preserve_formatting=preserve_formatting).parse(
_raise_http_errors(response, self.video_id).text, _raise_http_errors(response, self.video_id).text,
) )