mirror of
https://codeberg.org/polarisfm/youtube-dl
synced 2024-11-23 00:54:31 +01:00
[myvi:embed] Add extractor (closes #15521)
This commit is contained in:
parent
5a5860825d
commit
51b0557d1e
@ -3,12 +3,15 @@ from __future__ import unicode_literals
|
|||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
from .vimple import SprutoBaseIE
|
from .vimple import SprutoBaseIE
|
||||||
|
|
||||||
|
|
||||||
class MyviIE(SprutoBaseIE):
|
class MyviIE(SprutoBaseIE):
|
||||||
_VALID_URL = r'''(?x)
|
_VALID_URL = r'''(?x)
|
||||||
|
(?:
|
||||||
https?://
|
https?://
|
||||||
|
(?:www\.)?
|
||||||
myvi\.(?:ru/player|tv)/
|
myvi\.(?:ru/player|tv)/
|
||||||
(?:
|
(?:
|
||||||
(?:
|
(?:
|
||||||
@ -17,6 +20,8 @@ class MyviIE(SprutoBaseIE):
|
|||||||
api/Video/Get
|
api/Video/Get
|
||||||
)/|
|
)/|
|
||||||
content/preloader\.swf\?.*\bid=
|
content/preloader\.swf\?.*\bid=
|
||||||
|
)|
|
||||||
|
myvi:
|
||||||
)
|
)
|
||||||
(?P<id>[\da-zA-Z_-]+)
|
(?P<id>[\da-zA-Z_-]+)
|
||||||
'''
|
'''
|
||||||
@ -42,6 +47,9 @@ class MyviIE(SprutoBaseIE):
|
|||||||
}, {
|
}, {
|
||||||
'url': 'http://myvi.ru/player/flash/ocp2qZrHI-eZnHKQBK4cZV60hslH8LALnk0uBfKsB-Q4WnY26SeGoYPi8HWHxu0O30',
|
'url': 'http://myvi.ru/player/flash/ocp2qZrHI-eZnHKQBK4cZV60hslH8LALnk0uBfKsB-Q4WnY26SeGoYPi8HWHxu0O30',
|
||||||
'only_matching': True,
|
'only_matching': True,
|
||||||
|
}, {
|
||||||
|
'url': 'myvi:YwbqszQynUaHPn_s82sx0Q2',
|
||||||
|
'only_matching': True,
|
||||||
}]
|
}]
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ -58,3 +66,39 @@ class MyviIE(SprutoBaseIE):
|
|||||||
'http://myvi.ru/player/api/Video/Get/%s?sig' % video_id, video_id)['sprutoData']
|
'http://myvi.ru/player/api/Video/Get/%s?sig' % video_id, video_id)['sprutoData']
|
||||||
|
|
||||||
return self._extract_spruto(spruto, video_id)
|
return self._extract_spruto(spruto, video_id)
|
||||||
|
|
||||||
|
|
||||||
|
class MyviEmbedIE(InfoExtractor):
|
||||||
|
_VALID_URL = r'https?://(?:www\.)?myvi\.tv/(?:[^?]+\?.*?\bv=|embed/)(?P<id>[\da-z]+)'
|
||||||
|
_TESTS = [{
|
||||||
|
'url': 'https://www.myvi.tv/embed/ccdqic3wgkqwpb36x9sxg43t4r',
|
||||||
|
'info_dict': {
|
||||||
|
'id': 'b3ea0663-3234-469d-873e-7fecf36b31d1',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'Твоя (original song).mp4',
|
||||||
|
'thumbnail': r're:^https?://.*\.jpg$',
|
||||||
|
'duration': 277,
|
||||||
|
},
|
||||||
|
'params': {
|
||||||
|
'skip_download': True,
|
||||||
|
},
|
||||||
|
}, {
|
||||||
|
'url': 'https://www.myvi.tv/idmi6o?v=ccdqic3wgkqwpb36x9sxg43t4r#watch',
|
||||||
|
'only_matching': True,
|
||||||
|
}]
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def suitable(cls, url):
|
||||||
|
return False if MyviIE.suitable(url) else super(MyviEmbedIE, cls).suitable(url)
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
video_id = self._match_id(url)
|
||||||
|
|
||||||
|
webpage = self._download_webpage(
|
||||||
|
'https://www.myvi.tv/embed/%s' % video_id, video_id)
|
||||||
|
|
||||||
|
myvi_id = self._search_regex(
|
||||||
|
r'CreatePlayer\s*\(\s*["\'].*?\bv=([\da-zA-Z_]+)',
|
||||||
|
webpage, 'video id')
|
||||||
|
|
||||||
|
return self.url_result('myvi:%s' % myvi_id, ie=MyviIE.ie_key())
|
||||||
|
Loading…
Reference in New Issue
Block a user