Merge pull request #211 from jdepoix/bugfix/ISSUE-209

all requests use a accept-language: en-us header now
This commit is contained in:
Jonas Depoix 2023-06-16 15:15:18 +02:00 committed by GitHub
commit 31130dbe0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -88,7 +88,7 @@ class TranscriptListFetcher(object):
return html
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)
@ -288,7 +288,7 @@ class Transcript(object):
:return: a list of dictionaries containing the 'text', 'start' and 'duration' keys
: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(
_raise_http_errors(response, self.video_id).text,
)