[meta] Add support for pladform embeds

This commit is contained in:
Sergey M․ 2016-06-30 23:20:44 +07:00
parent 8ff6697861
commit fd94e2671a
No known key found for this signature in database
GPG Key ID: 2C393E0F18A9236D

View File

@ -2,6 +2,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from .common import InfoExtractor from .common import InfoExtractor
from .pladform import PladformIE
from ..utils import ( from ..utils import (
unescapeHTML, unescapeHTML,
int_or_none, int_or_none,
@ -27,34 +28,45 @@ class METAIE(InfoExtractor):
}, { }, {
'url': 'http://video.meta.ua/iframe/5502115', 'url': 'http://video.meta.ua/iframe/5502115',
'only_matching': True, 'only_matching': True,
}, {
# pladform embed
'url': 'http://video.meta.ua/7121015.video',
'only_matching': True,
}] }]
def _real_extract(self, url): def _real_extract(self, url):
video_id = self._match_id(url) video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id) webpage = self._download_webpage(url, video_id)
st_html5 = self._search_regex(r"st_html5\s*=\s*'#([^']+)'", webpage, 'uppod html5 st') st_html5 = self._search_regex(
json_str = '' r"st_html5\s*=\s*'#([^']+)'", webpage, 'uppod html5 st', default=None)
for i in range(0, len(st_html5), 3):
json_str += '&#x0%s;' % st_html5[i:i + 3]
uppod_data = self._parse_json(unescapeHTML(json_str), video_id)
error = uppod_data.get('customnotfound')
if error:
raise ExtractorError('%s said: %s' % (self.IE_NAME, error), expected=True)
video_url = uppod_data['file'] if st_html5:
info = { json_str = ''
'id': video_id, for i in range(0, len(st_html5), 3):
'url': video_url, json_str += '&#x0%s;' % st_html5[i:i + 3]
'title': uppod_data.get('comment') or self._og_search_title(webpage), uppod_data = self._parse_json(unescapeHTML(json_str), video_id)
'description': self._og_search_description(webpage, default=None), error = uppod_data.get('customnotfound')
'thumbnail': uppod_data.get('poster') or self._og_search_thumbnail(webpage), if error:
'duration': int_or_none(self._og_search_property( raise ExtractorError('%s said: %s' % (self.IE_NAME, error), expected=True)
'video:duration', webpage, default=None)),
} video_url = uppod_data['file']
if 'youtube.com/' in video_url: info = {
info.update({ 'id': video_id,
'_type': 'url_transparent', 'url': video_url,
'ie_key': 'Youtube', 'title': uppod_data.get('comment') or self._og_search_title(webpage),
}) 'description': self._og_search_description(webpage, default=None),
return info 'thumbnail': uppod_data.get('poster') or self._og_search_thumbnail(webpage),
'duration': int_or_none(self._og_search_property(
'video:duration', webpage, default=None)),
}
if 'youtube.com/' in video_url:
info.update({
'_type': 'url_transparent',
'ie_key': 'Youtube',
})
return info
pladform_url = PladformIE._extract_url(webpage)
if pladform_url:
return self.url_result(pladform_url)