Calculate regex default only once
This commit is contained in:
parent
2872ea4494
commit
be7ed83941
@ -313,11 +313,10 @@ class TVPlayIE(InfoExtractor):
|
|||||||
# TODO: webvtt in m3u8
|
# TODO: webvtt in m3u8
|
||||||
subtitles = {}
|
subtitles = {}
|
||||||
sub_paths = [video.get(key) for key in ['sami_path', 'subtitles_webvtt', 'subtitles_for_hearing_impaired']]
|
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:
|
for path in sub_paths:
|
||||||
if path:
|
if path:
|
||||||
lang = self._search_regex(
|
lang = self._search_regex(r'_(.*)(\.)', path, 'lang', default)
|
||||||
r'_(.*)(\.)', path, 'lang',
|
|
||||||
default=compat_urlparse.urlparse(url).netloc.rsplit('.', 1)[-1])
|
|
||||||
subtitles[lang] = [{
|
subtitles[lang] = [{
|
||||||
'url': path,
|
'url': path,
|
||||||
}]
|
}]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user