diff options
author | Sergey M․ <dstftw@gmail.com> | 2018-04-22 05:33:08 +0700 |
---|---|---|
committer | Sergey M․ <dstftw@gmail.com> | 2018-04-22 05:34:03 +0700 |
commit | 6cdaaf703149f1d6f1d24cfdb5a538ca41d08a26 (patch) | |
tree | 765121dc327054242cc6def7c693154b22acf793 /youtube_dl/extractor | |
parent | 488ff2dd3a193544a9912776d1c1b9d9fffc8fe7 (diff) |
[svt] Improve (closes #15809)
Diffstat (limited to 'youtube_dl/extractor')
-rw-r--r-- | youtube_dl/extractor/svt.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/youtube_dl/extractor/svt.py b/youtube_dl/extractor/svt.py index d01f85422..f71eab8b2 100644 --- a/youtube_dl/extractor/svt.py +++ b/youtube_dl/extractor/svt.py @@ -137,7 +137,7 @@ class SVTPlayBaseIE(SVTBaseIE): class SVTPlayIE(SVTPlayBaseIE): IE_DESC = 'SVT Play and Öppet arkiv' - _VALID_URL = r'https?://(?:www\.)?(?:svtplay|oppetarkiv)\.se/(?:video|klipp|kanaler)/(?P<id>\w+)' + _VALID_URL = r'https?://(?:www\.)?(?:svtplay|oppetarkiv)\.se/(?:video|klipp|kanaler)/(?P<id>[^/?#&]+)' _TESTS = [{ 'url': 'http://www.svtplay.se/video/5996901/flygplan-till-haile-selassie/flygplan-till-haile-selassie-2', 'md5': '2b6704fe4a28801e1a098bbf3c5ac611', @@ -179,6 +179,10 @@ class SVTPlayIE(SVTPlayBaseIE): thumbnail = self._og_search_thumbnail(webpage) + def adjust_title(info): + if info['is_live']: + info['title'] = self._live_title(info['title']) + if data: video_info = try_get( data, lambda x: x['context']['dispatcher']['stores']['VideoTitlePageStore']['data']['video'], @@ -189,8 +193,7 @@ class SVTPlayIE(SVTPlayBaseIE): 'title': data['context']['dispatcher']['stores']['MetaStore']['title'], 'thumbnail': thumbnail, }) - if info_dict['is_live']: - info_dict['title'] = self._live_title(info_dict['title']) + adjust_title(info_dict) return info_dict video_id = self._search_regex( @@ -206,8 +209,7 @@ class SVTPlayIE(SVTPlayBaseIE): info_dict['title'] = re.sub( r'\s*\|\s*.+?$', '', info_dict.get('episode') or self._og_search_title(webpage)) - if info_dict['is_live']: - info_dict['title'] = self._live_title(info_dict['title']) + adjust_title(info_dict) return info_dict |