]>
jfr.im git - yt-dlp.git/blob - youtube_dl/extractor/miomio.py
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
13 class MioMioIE(InfoExtractor
):
15 _VALID_URL
= r
'https?://(?:www\.)?miomio\.tv/watch/cc(?P<id>[0-9]+)'
17 'url': 'http://www.miomio.tv/watch/cc179734/',
18 'md5': '48de02137d0739c15b440a224ad364b9',
22 'title': '手绘动漫鬼泣但丁全程画法',
26 'url': 'http://www.miomio.tv/watch/cc184024/',
29 'title': '《动漫同人插画绘制》',
31 'playlist_mincount': 86,
34 def _real_extract(self
, url
):
35 video_id
= self
._match
_id
(url
)
36 webpage
= self
._download
_webpage
(url
, video_id
)
38 title
= self
._html
_search
_meta
(
39 'description', webpage
, 'title', fatal
=True)
41 mioplayer_path
= self
._search
_regex
(
42 r
'src="(/mioplayer/[^"]+)"', webpage
, 'ref_path')
44 xml_config
= self
._search
_regex
(
45 r
'flashvars="type=sina&(.+?)&',
46 webpage
, 'xml config')
48 # skipping the following page causes lags and eventually connection drop-outs
49 self
._request
_webpage
(
50 'http://www.miomio.tv/mioplayer/mioplayerconfigfiles/xml.php?id=%s&r=%s' % (id, random
.randint(100, 999)),
53 # the following xml contains the actual configuration information on the video file(s)
54 vid_config
= self
._download
_xml
(
55 'http://www.miomio.tv/mioplayer/mioplayerconfigfiles/sina.php?{0}'.format(xml_config
),
59 'Referer': 'http://www.miomio.tv%s' % mioplayer_path
,
63 for f
in vid_config
.findall('./durl'):
64 segment_url
= xpath_text(f
, 'url', 'video url')
67 order
= xpath_text(f
, 'order', 'order')
71 segment_id
+= '-%s' % order
72 segment_title
+= ' part %s' % order
76 'title': segment_title
,
77 'duration': int_or_none(xpath_text(f
, 'length', 'duration'), 1000),
78 'http_headers': http_headers
,
83 segment
['id'] = video_id
84 segment
['title'] = title
88 '_type': 'multi_video',
92 'http_headers': http_headers
,