1 from __future__
import unicode_literals
5 from .common
import InfoExtractor
8 compat_urllib_parse_unquote
,
12 get_element_by_attribute
,
18 class MiTeleIE(InfoExtractor
):
20 _VALID_URL
= r
'http://www\.mitele\.es/[^/]+/[^/]+/[^/]+/(?P<id>[^/]+)/'
23 'url': 'http://www.mitele.es/programas-tv/diario-de/la-redaccion/programa-144/',
27 'title': 'Programa 144 - Tor, la web invisible',
28 'description': 'md5:3b6fce7eaa41b2d97358726378d9369f',
29 'display_id': 'programa-144',
34 'skip_download': True,
38 def _real_extract(self
, url
):
39 episode
= self
._match
_id
(url
)
40 webpage
= self
._download
_webpage
(url
, episode
)
41 embed_data_json
= self
._search
_regex
(
42 r
'(?s)MSV\.embedData\[.*?\]\s*=\s*({.*?});', webpage
, 'embed data',
44 embed_data
= json
.loads(embed_data_json
)
46 domain
= embed_data
['mediaUrl']
47 if not domain
.startswith('http'):
48 # only happens in telecinco.es videos
49 domain
= 'http://' + domain
50 info_url
= compat_urlparse
.urljoin(
52 compat_urllib_parse_unquote(embed_data
['flashvars']['host'])
54 info_el
= self
._download
_xml
(info_url
, episode
).find('./video/info')
56 video_link
= info_el
.find('videoUrl/link').text
57 token_query
= compat_urllib_parse
.urlencode({'id': video_link
})
58 token_info
= self
._download
_json
(
59 embed_data
['flashvars']['ov_tk'] + '?' + token_query
,
61 transform_source
=strip_jsonp
63 formats
= self
._extract
_m
3u8_formats
(
64 token_info
['tokenizedUrl'], episode
, ext
='mp4')
67 'id': embed_data
['videoId'],
68 'display_id': episode
,
69 'title': info_el
.find('title').text
,
71 'description': get_element_by_attribute('class', 'text', webpage
),
72 'thumbnail': info_el
.find('thumb').text
,
73 'duration': parse_duration(info_el
.find('duration').text
),