]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/mitele.py
d8897eb90d526b7b7d2e5a5ace5bec84ebb40031
1 from __future__
import unicode_literals
5 from .common
import InfoExtractor
11 get_element_by_attribute
,
17 class MiTeleIE(InfoExtractor
):
19 _VALID_URL
= r
'http://www\.mitele\.es/[^/]+/[^/]+/[^/]+/(?P<id>[^/]+)/'
22 'url': 'http://www.mitele.es/programas-tv/diario-de/la-redaccion/programa-144/',
23 'md5': '6a75fe9d0d3275bead0cb683c616fddb',
27 'title': 'Programa 144 - Tor, la web invisible',
28 'description': 'md5:3b6fce7eaa41b2d97358726378d9369f',
29 'display_id': 'programa-144',
34 def _real_extract(self
, url
):
35 episode
= self
._match
_id
(url
)
36 webpage
= self
._download
_webpage
(url
, episode
)
37 embed_data_json
= self
._search
_regex
(
38 r
'(?s)MSV\.embedData\[.*?\]\s*=\s*({.*?});', webpage
, 'embed data',
40 embed_data
= json
.loads(embed_data_json
)
42 domain
= embed_data
['mediaUrl']
43 if not domain
.startswith('http'):
44 # only happens in telecinco.es videos
45 domain
= 'http://' + domain
46 info_url
= compat_urlparse
.urljoin(
48 compat_urllib_parse
.unquote(embed_data
['flashvars']['host'])
50 info_el
= self
._download
_xml
(info_url
, episode
).find('./video/info')
52 video_link
= info_el
.find('videoUrl/link').text
53 token_query
= compat_urllib_parse
.urlencode({'id': video_link
})
54 token_info
= self
._download
_json
(
55 embed_data
['flashvars']['ov_tk'] + '?' + token_query
,
57 transform_source
=strip_jsonp
61 'id': embed_data
['videoId'],
62 'display_id': episode
,
63 'title': info_el
.find('title').text
,
64 'url': token_info
['tokenizedUrl'],
65 'description': get_element_by_attribute('class', 'text', webpage
),
66 'thumbnail': info_el
.find('thumb').text
,
67 'duration': parse_duration(info_el
.find('duration').text
),