1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-11-02 17:22:31 +01:00

Merge pull request #124 from nixxo/mailru-fix

[mailru] removed escaped braces, use urljoin, added tests
This commit is contained in:
Tom-Oliver Heidel 2020-11-07 15:08:03 +01:00 committed by GitHub
commit 4a82c025da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,6 +12,7 @@
parse_duration, parse_duration,
remove_end, remove_end,
try_get, try_get,
urljoin,
) )
@ -93,6 +94,14 @@ class MailRuIE(InfoExtractor):
{ {
'url': 'https://my.mail.ru//list//sinyutin10/video/_myvideo/4.html', 'url': 'https://my.mail.ru//list//sinyutin10/video/_myvideo/4.html',
'only_matching': True, 'only_matching': True,
},
{
'url': 'https://my.mail.ru/mail/cloud-strife/video/embed/Games/2009',
'only_matching': True,
},
{
'url': 'https://videoapi.my.mail.ru/videos/embed/mail/cloud-strife/Games/2009.html',
'only_matching': True,
} }
] ]
@ -110,7 +119,7 @@ def _real_extract(self, url):
webpage = self._download_webpage(url, video_id) webpage = self._download_webpage(url, video_id)
page_config = self._parse_json(self._search_regex([ page_config = self._parse_json(self._search_regex([
r'(?s)<script[^>]+class="sp-video__page-config"[^>]*>(.+?)</script>', r'(?s)<script[^>]+class="sp-video__page-config"[^>]*>(.+?)</script>',
r'(?s)"video":\s*(\{.+?\}),'], r'(?s)"video":\s*({.+?}),'],
webpage, 'page config', default='{}'), video_id, fatal=False) webpage, 'page config', default='{}'), video_id, fatal=False)
if page_config: if page_config:
meta_url = page_config.get('metaUrl') or page_config.get('video', {}).get('metaUrl') or page_config.get('metadataUrl') meta_url = page_config.get('metaUrl') or page_config.get('video', {}).get('metaUrl') or page_config.get('metadataUrl')
@ -121,7 +130,7 @@ def _real_extract(self, url):
# fix meta_url if missing the host address # fix meta_url if missing the host address
if re.match(r'^\/\+\/', meta_url): if re.match(r'^\/\+\/', meta_url):
meta_url = 'https://my.mail.ru' + meta_url meta_url = urljoin('https://my.mail.ru', meta_url)
if meta_url: if meta_url:
video_data = self._download_json( video_data = self._download_json(