[rutv] Improve flash version pattern (Closes #8911)

This commit is contained in:
Sergey M․ 2016-03-21 21:46:49 +06:00
parent 5886b38d73
commit 1600ed1ff9

View file

@ -14,7 +14,7 @@ class RUTVIE(InfoExtractor):
IE_DESC = 'RUTV.RU' IE_DESC = 'RUTV.RU'
_VALID_URL = r'''(?x) _VALID_URL = r'''(?x)
https?://player\.(?:rutv\.ru|vgtrk\.com)/ https?://player\.(?:rutv\.ru|vgtrk\.com)/
(?P<path>flash2v/container\.swf\?id= (?P<path>flash\d+v/container\.swf\?id=
|iframe/(?P<type>swf|video|live)/id/ |iframe/(?P<type>swf|video|live)/id/
|index/iframe/cast_id/) |index/iframe/cast_id/)
(?P<id>\d+)''' (?P<id>\d+)'''
@ -109,7 +109,7 @@ def _extract_url(cls, webpage):
return mobj.group('url') return mobj.group('url')
mobj = re.search( mobj = re.search(
r'<meta[^>]+?property=(["\'])og:video\1[^>]+?content=(["\'])(?P<url>https?://player\.(?:rutv\.ru|vgtrk\.com)/flash2v/container\.swf\?id=.+?\2)', r'<meta[^>]+?property=(["\'])og:video\1[^>]+?content=(["\'])(?P<url>https?://player\.(?:rutv\.ru|vgtrk\.com)/flash\d+v/container\.swf\?id=.+?\2)',
webpage) webpage)
if mobj: if mobj:
return mobj.group('url') return mobj.group('url')
@ -119,7 +119,7 @@ def _real_extract(self, url):
video_id = mobj.group('id') video_id = mobj.group('id')
video_path = mobj.group('path') video_path = mobj.group('path')
if video_path.startswith('flash2v'): if re.match(r'flash\d+v', video_path):
video_type = 'video' video_type = 'video'
elif video_path.startswith('iframe'): elif video_path.startswith('iframe'):
video_type = mobj.group('type') video_type = mobj.group('type')
@ -168,7 +168,7 @@ def _real_extract(self, url):
'play_path': mobj.group('playpath'), 'play_path': mobj.group('playpath'),
'app': mobj.group('app'), 'app': mobj.group('app'),
'page_url': 'http://player.rutv.ru', 'page_url': 'http://player.rutv.ru',
'player_url': 'http://player.rutv.ru/flash2v/osmf.swf?i=22', 'player_url': 'http://player.rutv.ru/flash3v/osmf.swf?i=22',
'rtmp_live': True, 'rtmp_live': True,
'ext': 'flv', 'ext': 'flv',
'vbr': int(quality), 'vbr': int(quality),