Merge pull request #32 from jdepoix/bugfix/ISSUE-29

adjusted to changes in YouTube webclient
This commit is contained in:
jdepoix 2019-10-09 13:30:09 +02:00 committed by GitHub
commit 8280e19c29
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1747 additions and 1023 deletions

View File

@ -28,7 +28,9 @@ class YouTubeTranscriptApi():
' - none of the languages you provided are supported by the video\n' ' - none of the languages you provided are supported by the video\n'
' - the video is no longer available.\n\n' ' - the video is no longer available.\n\n'
'If none of these things is the case, please create an issue at ' 'If none of these things is the case, please create an issue at '
'https://github.com/jdepoix/youtube-transcript-api/issues' 'https://github.com/jdepoix/youtube-transcript-api/issues.'
'Please add which version of youtube_transcript_api you are using and make sure that there '
'are no open issues which already describe your problem!'
) )
def __init__(self, video_id): def __init__(self, video_id):
@ -99,7 +101,7 @@ class _TranscriptFetcher():
WATCH_URL = 'https://www.youtube.com/watch?v={video_id}' WATCH_URL = 'https://www.youtube.com/watch?v={video_id}'
API_BASE_URL = 'https://www.youtube.com/api/{api_url}' API_BASE_URL = 'https://www.youtube.com/api/{api_url}'
LANGUAGE_REGEX = re.compile(r'(&lang=.*&)|(&lang=.*)') LANGUAGE_REGEX = re.compile(r'(&lang=.*&)|(&lang=.*)')
TIMEDTEXT_STRING = 'timedtext' TIMEDTEXT_STRING = 'timedtext?v='
def __init__(self, video_id, languages, proxies): def __init__(self, video_id, languages, proxies):
self.video_id = video_id self.video_id = video_id

File diff suppressed because one or more lines are too long