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