]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/miomio.py
ce391c759c22af0cb8949118b3915602197b9f47
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
7 from ..compat
import compat_urllib_request
15 class MioMioIE(InfoExtractor
):
17 _VALID_URL
= r
'https?://(?:www\.)?miomio\.tv/watch/cc(?P<id>[0-9]+)'
19 # "type=video" in flashvars
20 'url': 'http://www.miomio.tv/watch/cc88912/',
21 'md5': '317a5f7f6b544ce8419b784ca8edae65',
25 'title': '【SKY】字幕 铠武昭和VS平成 假面骑士大战FEAT战队 魔星字幕组 字幕',
29 'url': 'http://www.miomio.tv/watch/cc184024/',
32 'title': '《动漫同人插画绘制》',
34 'playlist_mincount': 86,
35 'skip': 'This video takes time too long for retrieving the URL',
37 'url': 'http://www.miomio.tv/watch/cc173113/',
40 'title': 'The New Macbook 2015 上手试玩与简评'
42 'playlist_mincount': 2,
45 def _real_extract(self
, url
):
46 video_id
= self
._match
_id
(url
)
47 webpage
= self
._download
_webpage
(url
, video_id
)
49 title
= self
._html
_search
_meta
(
50 'description', webpage
, 'title', fatal
=True)
52 mioplayer_path
= self
._search
_regex
(
53 r
'src="(/mioplayer/[^"]+)"', webpage
, 'ref_path')
55 http_headers
= {'Referer': 'http://www.miomio.tv%s' % mioplayer_path
}
57 xml_config
= self
._search
_regex
(
58 r
'flashvars="type=(?:sina|video)&(.+?)&',
59 webpage
, 'xml config')
61 # skipping the following page causes lags and eventually connection drop-outs
62 self
._request
_webpage
(
63 'http://www.miomio.tv/mioplayer/mioplayerconfigfiles/xml.php?id=%s&r=%s' % (id, random
.randint(100, 999)),
66 vid_config_request
= compat_urllib_request
.Request(
67 'http://www.miomio.tv/mioplayer/mioplayerconfigfiles/sina.php?{0}'.format(xml_config
),
70 # the following xml contains the actual configuration information on the video file(s)
71 vid_config
= self
._download
_xml
(vid_config_request
, video_id
)
73 if not int_or_none(xpath_text(vid_config
, 'timelength')):
74 raise ExtractorError('Unable to load videos!', expected
=True)
77 for f
in vid_config
.findall('./durl'):
78 segment_url
= xpath_text(f
, 'url', 'video url')
81 order
= xpath_text(f
, 'order', 'order')
85 segment_id
+= '-%s' % order
86 segment_title
+= ' part %s' % order
90 'title': segment_title
,
91 'duration': int_or_none(xpath_text(f
, 'length', 'duration'), 1000),
92 'http_headers': http_headers
,
97 segment
['id'] = video_id
98 segment
['title'] = title
102 '_type': 'multi_video',
106 'http_headers': http_headers
,