aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/srgssr.py
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2019-05-24 00:43:22 +0700
committerSergey M․ <dstftw@gmail.com>2019-05-24 00:45:06 +0700
commit25b83c2a0e29c75372f0ce26d2b4ecf493e8b28c (patch)
tree81806235318793c9001e5e1233c7de30900928ef /youtube_dl/extractor/srgssr.py
parent3fe774722b0855d572b6885ff20fb6f4f96f3e08 (diff)
[srgssrplay] Improve _VALID_URL (closes #21155)
Diffstat (limited to 'youtube_dl/extractor/srgssr.py')
-rw-r--r--youtube_dl/extractor/srgssr.py26
1 files changed, 15 insertions, 11 deletions
diff --git a/youtube_dl/extractor/srgssr.py b/youtube_dl/extractor/srgssr.py
index ff1b67876..170dce87f 100644
--- a/youtube_dl/extractor/srgssr.py
+++ b/youtube_dl/extractor/srgssr.py
@@ -106,7 +106,16 @@ class SRGSSRIE(InfoExtractor):
class SRGSSRPlayIE(InfoExtractor):
IE_DESC = 'srf.ch, rts.ch, rsi.ch, rtr.ch and swissinfo.ch play sites'
- _VALID_URL = r'https?://(?:(?:www|play)\.)?(?P<bu>srf|rts|rsi|rtr|swissinfo)\.ch/play/(?:tv|radio)/(?:[^/]+/|popup)(?P<type>video|audio)(?:/[^?]+|player)\?id=(?P<id>[0-9a-f\-]{36}|\d+)'
+ _VALID_URL = r'''(?x)
+ https?://
+ (?:(?:www|play)\.)?
+ (?P<bu>srf|rts|rsi|rtr|swissinfo)\.ch/play/(?:tv|radio)/
+ (?:
+ [^/]+/(?P<type>video|audio)/[^?]+|
+ popup(?P<type_2>video|audio)player
+ )
+ \?id=(?P<id>[0-9a-f\-]{36}|\d+)
+ '''
_TESTS = [{
'url': 'http://www.srf.ch/play/tv/10vor10/video/snowden-beantragt-asyl-in-russland?id=28e1a57d-5b76-4399-8ab3-9097f071e6c5',
@@ -165,18 +174,13 @@ class SRGSSRPlayIE(InfoExtractor):
}
}, {
'url': 'https://www.srf.ch/play/tv/popupvideoplayer?id=c4dba0ca-e75b-43b2-a34f-f708a4932e01',
- 'md5': 'f6247aa7c905b81c9ba7f50fb22e2fbd',
- 'info_dict': {
- 'id': 'c4dba0ca-e75b-43b2-a34f-f708a4932e01',
- 'ext': 'mp4',
- 'upload_date': '20190122',
- 'title': 'Erster Selfie-Stick (1983)',
- 'description': 'md5:23a6b40024e583137e4137f5946543c1',
- 'timestamp': 1548155133,
- }
+ 'only_matching': True,
}]
def _real_extract(self, url):
- bu, media_type, media_id = re.match(self._VALID_URL, url).groups()
+ mobj = re.match(self._VALID_URL, url)
+ bu = mobj.group('bu')
+ media_type = mobj.group('type') or mobj.group('type_2')
+ media_id = mobj.group('id')
# other info can be extracted from url + '&layout=json'
return self.url_result('srgssr:%s:%s:%s' % (bu[:3], media_type, media_id), 'SRGSSR')