mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-21 20:46:36 -05:00
[youtube] Ensure subtitle urls are absolute (#2765)
Closes #2755 Authored by: coletdjnz
This commit is contained in:
parent
88afe05695
commit
60f393e48b
1 changed files with 3 additions and 12 deletions
|
@ -2245,12 +2245,7 @@ def _extract_player_url(self, *ytcfgs, webpage=None):
|
||||||
get_all=False, expected_type=compat_str)
|
get_all=False, expected_type=compat_str)
|
||||||
if not player_url:
|
if not player_url:
|
||||||
return
|
return
|
||||||
if player_url.startswith('//'):
|
return urljoin('https://www.youtube.com', player_url)
|
||||||
player_url = 'https:' + player_url
|
|
||||||
elif not re.match(r'https?://', player_url):
|
|
||||||
player_url = compat_urlparse.urljoin(
|
|
||||||
'https://www.youtube.com', player_url)
|
|
||||||
return player_url
|
|
||||||
|
|
||||||
def _download_player_url(self, video_id, fatal=False):
|
def _download_player_url(self, video_id, fatal=False):
|
||||||
res = self._download_webpage(
|
res = self._download_webpage(
|
||||||
|
@ -2399,11 +2394,7 @@ def _decrypt_nsig(self, s, video_id, player_url):
|
||||||
"""Turn the encrypted n field into a working signature"""
|
"""Turn the encrypted n field into a working signature"""
|
||||||
if player_url is None:
|
if player_url is None:
|
||||||
raise ExtractorError('Cannot decrypt nsig without player_url')
|
raise ExtractorError('Cannot decrypt nsig without player_url')
|
||||||
if player_url.startswith('//'):
|
player_url = urljoin('https://www.youtube.com', player_url)
|
||||||
player_url = 'https:' + player_url
|
|
||||||
elif not re.match(r'https?://', player_url):
|
|
||||||
player_url = compat_urlparse.urljoin(
|
|
||||||
'https://www.youtube.com', player_url)
|
|
||||||
|
|
||||||
sig_id = ('nsig_value', s)
|
sig_id = ('nsig_value', s)
|
||||||
if sig_id in self._player_cache:
|
if sig_id in self._player_cache:
|
||||||
|
@ -3388,7 +3379,7 @@ def process_language(container, base_url, lang_code, sub_name, query):
|
||||||
})
|
})
|
||||||
lang_subs.append({
|
lang_subs.append({
|
||||||
'ext': fmt,
|
'ext': fmt,
|
||||||
'url': update_url_query(base_url, query),
|
'url': urljoin('https://www.youtube.com', update_url_query(base_url, query)),
|
||||||
'name': sub_name,
|
'name': sub_name,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue