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/',
26 'title': 'Programa 144 - Tor, la web invisible',
27 'description': 'md5:3b6fce7eaa41b2d97358726378d9369f',
28 'display_id': 'programa-144',
33 'skip_download': True,
37 def _real_extract(self, url):
38 episode = self._match_id(url)
39 webpage = self._download_webpage(url, episode)
40 embed_data_json = self._search_regex(
41 r'(?s)MSV\.embedData\[.*?\]\s*=\s*({.*?});', webpage, 'embed data',
43 embed_data = json.loads(embed_data_json)
45 domain = embed_data['mediaUrl']
46 if not domain.startswith('http'):
47 # only happens in telecinco.es videos
48 domain = 'http://' + domain
49 info_url = compat_urlparse.urljoin(
51 compat_urllib_parse.unquote(embed_data['flashvars']['host'])
53 info_el = self._download_xml(info_url, episode).find('./video/info')
55 video_link = info_el.find('videoUrl/link').text
56 token_query = compat_urllib_parse.urlencode({'id': video_link})
57 token_info = self._download_json(
58 embed_data['flashvars']['ov_tk'] + '?' + token_query,
60 transform_source=strip_jsonp
62 formats = self._extract_m3u8_formats(
63 token_info['tokenizedUrl'], episode, ext='mp4')
66 'id': embed_data['videoId'],
67 'display_id': episode,
68 'title': info_el.find('title').text,
70 'description': get_element_by_attribute('class', 'text', webpage),
71 'thumbnail': info_el.find('thumb').text,
72 'duration': parse_duration(info_el.find('duration').text),