1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2025-02-17 01:17:54 +01:00

Calculate regex default only once

This commit is contained in:
David Pedersen 2019-07-11 13:23:24 +02:00
parent 2872ea4494
commit be7ed83941

View File

@ -313,11 +313,10 @@ class TVPlayIE(InfoExtractor):
# TODO: webvtt in m3u8
subtitles = {}
sub_paths = [video.get(key) for key in ['sami_path', 'subtitles_webvtt', 'subtitles_for_hearing_impaired']]
default = compat_urlparse.urlparse(url).netloc.rsplit('.', 1)[-1]
for path in sub_paths:
if path:
lang = self._search_regex(
r'_(.*)(\.)', path, 'lang',
default=compat_urlparse.urlparse(url).netloc.rsplit('.', 1)[-1])
lang = self._search_regex(r'_(.*)(\.)', path, 'lang', default)
subtitles[lang] = [{
'url': path,
}]