2 from __future__ import unicode_literals
4 from .common import InfoExtractor
7 class MiomioTvIE(InfoExtractor):
9 _VALID_URL = r'https?://(?:www\.)?miomio\.tv/watch/cc(?P<id>[0-9]+)'
11 'url': 'http://www.miomio.tv/watch/cc179734/',
12 'md5': '48de02137d0739c15b440a224ad364b9',
15 'title': u'\u624b\u7ed8\u52a8\u6f2b\u9b3c\u6ce3\u4f46\u4e01\u5168\u7a0b\u753b\u6cd5',
20 def _real_extract(self, url):
21 video_id = self._match_id(url)
22 webpage = self._download_webpage(url, video_id)
24 title = self._html_search_regex(r'<meta\s+name="description"\s+content="\s*([^"]*)\s*"', webpage, 'title')
25 ref_path = self._search_regex(r'src="(/mioplayer/.*?)"', webpage, 'ref_path')
26 referer = 'http://www.miomio.tv{}'.format(ref_path)
27 xml_config = self._search_regex(r'flashvars="type=sina&(.*?)&cid=', webpage, 'xml config')
28 self._request_webpage("http://www.miomio.tv/mioplayer/mioplayerconfigfiles/xml.php?id={}&r=cc{}".format(id, 945), video_id)
29 xml_url = 'http://www.miomio.tv/mioplayer/mioplayerconfigfiles/sina.php?{}'.format(xml_config)
30 vidconfig = self._download_xml(xml_url, video_id)
32 file_els = vidconfig.findall('.//durl')
36 for file_el in file_els:
37 segment_id = file_el.find('order').text.strip()
38 segment_title = '_'.join([title, segment_id])
39 segment_duration = file_el.find('length').text.strip()
40 segment_url = file_el.find('url').text.strip()
44 'title': segment_title,
45 'duration': segment_duration,
51 'Accept-Language': 'en,en-US;q=0.7,de;q=0.3',
52 'Accept-Encoding': 'gzip, deflate',
53 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'
60 'url': entries[0]['url'],
61 'http_headers': http_headers
65 '_type': 'multi_video',
69 'http_headers': http_headers