2 from __future__ import unicode_literals
6 from .common import InfoExtractor
14 class MioMioIE(InfoExtractor):
16 _VALID_URL = r'https?://(?:www\.)?miomio\.tv/watch/cc(?P<id>[0-9]+)'
18 # "type=video" in flashvars
19 'url': 'http://www.miomio.tv/watch/cc88912/',
20 'md5': '317a5f7f6b544ce8419b784ca8edae65',
24 'title': '【SKY】字幕 铠武昭和VS平成 假面骑士大战FEAT战队 魔星字幕组 字幕',
28 'url': 'http://www.miomio.tv/watch/cc184024/',
31 'title': '《动漫同人插画绘制》',
33 'playlist_mincount': 86,
36 def _real_extract(self, url):
37 video_id = self._match_id(url)
38 webpage = self._download_webpage(url, video_id)
40 title = self._html_search_meta(
41 'description', webpage, 'title', fatal=True)
43 mioplayer_path = self._search_regex(
44 r'src="(/mioplayer/[^"]+)"', webpage, 'ref_path')
46 xml_config = self._search_regex(
47 r'flashvars="type=(?:sina|video)&(.+?)&',
48 webpage, 'xml config')
50 # skipping the following page causes lags and eventually connection drop-outs
51 self._request_webpage(
52 'http://www.miomio.tv/mioplayer/mioplayerconfigfiles/xml.php?id=%s&r=%s' % (id, random.randint(100, 999)),
55 # the following xml contains the actual configuration information on the video file(s)
56 vid_config = self._download_xml(
57 'http://www.miomio.tv/mioplayer/mioplayerconfigfiles/sina.php?{0}'.format(xml_config),
61 'Referer': 'http://www.miomio.tv%s' % mioplayer_path,
64 if not int_or_none(xpath_text(vid_config, 'timelength')):
65 raise ExtractorError('Unable to load videos!', expected=True)
68 for f in vid_config.findall('./durl'):
69 segment_url = xpath_text(f, 'url', 'video url')
72 order = xpath_text(f, 'order', 'order')
76 segment_id += '-%s' % order
77 segment_title += ' part %s' % order
81 'title': segment_title,
82 'duration': int_or_none(xpath_text(f, 'length', 'duration'), 1000),
83 'http_headers': http_headers,
88 segment['id'] = video_id
89 segment['title'] = title
93 '_type': 'multi_video',
97 'http_headers': http_headers,