1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-11-10 13:12:45 +01:00

[myvi:embed] Improve _VALID_URL

This commit is contained in:
Sergey M․ 2015-07-10 00:27:02 +06:00
parent e6c2d9ad29
commit f2f89c762a

View File

@ -13,11 +13,12 @@ class MyviEmbedIE(SprutoBaseIE):
(?: (?:
(?: (?:
embed/html| embed/html|
flash|
api/Video/Get api/Video/Get
)/| )/|
content/preloader\.swf\?.*\bid= content/preloader\.swf\?.*\bid=
) )
(?P<id>[\da-zA-Z_]+) (?P<id>[\da-zA-Z_-]+)
''' '''
_TESTS = [{ _TESTS = [{
'url': 'http://myvi.ru/player/embed/html/oOy4euHA6LVwNNAjhD9_Jq5Ha2Qf0rtVMVFMAZav8wObeRTZaCATzucDQIDph8hQU0', 'url': 'http://myvi.ru/player/embed/html/oOy4euHA6LVwNNAjhD9_Jq5Ha2Qf0rtVMVFMAZav8wObeRTZaCATzucDQIDph8hQU0',
@ -38,12 +39,15 @@ class MyviEmbedIE(SprutoBaseIE):
}, { }, {
'url': 'http://myvi.tv/embed/html/oTGTNWdyz4Zwy_u1nraolwZ1odenTd9WkTnRfIL9y8VOgHYqOHApE575x4_xxS9Vn0?ap=0', 'url': 'http://myvi.tv/embed/html/oTGTNWdyz4Zwy_u1nraolwZ1odenTd9WkTnRfIL9y8VOgHYqOHApE575x4_xxS9Vn0?ap=0',
'only_matching': True, 'only_matching': True,
}, {
'url': 'http://myvi.ru/player/flash/ocp2qZrHI-eZnHKQBK4cZV60hslH8LALnk0uBfKsB-Q4WnY26SeGoYPi8HWHxu0O30',
'only_matching': True,
}] }]
@classmethod @classmethod
def _extract_url(cls, webpage): def _extract_url(cls, webpage):
mobj = re.search( mobj = re.search(
r'<iframe[^>]+?src=(["\'])(?P<url>(?:https?:)?//myvi\.(?:ru/player|tv)/embed/html/[^"]+)\1', webpage) r'<iframe[^>]+?src=(["\'])(?P<url>(?:https?:)?//myvi\.(?:ru/player|tv)/(?:embed/html|flash)/[^"]+)\1', webpage)
if mobj: if mobj:
return mobj.group('url') return mobj.group('url')