]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/miomio.py
a784fc5fba41c5931f6b1f040042e1900a6ff791
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,
34 'skip': 'This video takes time too long for retrieving the URL',
36 'url': 'http://www.miomio.tv/watch/cc173113/',
39 'title': 'The New Macbook 2015 上手试玩与简评'
41 'playlist_mincount': 2,
44 def _real_extract(self
, url
):
45 video_id
= self
._match
_id
(url
)
46 webpage
= self
._download
_webpage
(url
, video_id
)
48 title
= self
._html
_search
_meta
(
49 'description', webpage
, 'title', fatal
=True)
51 mioplayer_path
= self
._search
_regex
(
52 r
'src="(/mioplayer/[^"]+)"', webpage
, 'ref_path')
54 xml_config
= self
._search
_regex
(
55 r
'flashvars="type=(?:sina|video)&(.+?)&',
56 webpage
, 'xml config')
58 # skipping the following page causes lags and eventually connection drop-outs
59 self
._request
_webpage
(
60 'http://www.miomio.tv/mioplayer/mioplayerconfigfiles/xml.php?id=%s&r=%s' % (id, random
.randint(100, 999)),
63 # the following xml contains the actual configuration information on the video file(s)
64 vid_config
= self
._download
_xml
(
65 'http://www.miomio.tv/mioplayer/mioplayerconfigfiles/sina.php?{0}'.format(xml_config
),
69 'Referer': 'http://www.miomio.tv%s' % mioplayer_path
,
72 if not int_or_none(xpath_text(vid_config
, 'timelength')):
73 raise ExtractorError('Unable to load videos!', expected
=True)
76 for f
in vid_config
.findall('./durl'):
77 segment_url
= xpath_text(f
, 'url', 'video url')
80 order
= xpath_text(f
, 'order', 'order')
84 segment_id
+= '-%s' % order
85 segment_title
+= ' part %s' % order
89 'title': segment_title
,
90 'duration': int_or_none(xpath_text(f
, 'length', 'duration'), 1000),
91 'http_headers': http_headers
,
96 segment
['id'] = video_id
97 segment
['title'] = title
101 '_type': 'multi_video',
105 'http_headers': http_headers
,