1 from __future__ import unicode_literals
6 from .common import InfoExtractor
9 get_element_by_attribute,
15 class MiTeleIE(InfoExtractor):
17 _VALID_URL = r'http://www\.mitele\.es/[^/]+/[^/]+/[^/]+/(?P<episode>[^/]+)/'
20 'url': 'http://www.mitele.es/programas-tv/diario-de/la-redaccion/programa-144/',
21 'md5': '6a75fe9d0d3275bead0cb683c616fddb',
25 'title': 'Programa 144 - Tor, la web invisible',
26 'description': 'md5:3b6fce7eaa41b2d97358726378d9369f',
27 'display_id': 'programa-144',
32 def _real_extract(self, url):
33 mobj = re.match(self._VALID_URL, url)
34 episode = mobj.group('episode')
35 webpage = self._download_webpage(url, episode)
36 embed_data_json = self._search_regex(
37 r'MSV\.embedData\[.*?\]\s*=\s*({.*?});', webpage, 'embed data',
40 embed_data = json.loads(embed_data_json)
42 info_url = embed_data['flashvars']['host']
43 info_el = self._download_xml(info_url, episode).find('./video/info')
45 video_link = info_el.find('videoUrl/link').text
46 token_query = compat_urllib_parse.urlencode({'id': video_link})
47 token_info = self._download_json(
48 'http://token.mitele.es/?' + token_query, episode,
49 transform_source=strip_jsonp
53 'id': embed_data['videoId'],
54 'display_id': episode,
55 'title': info_el.find('title').text,
56 'url': token_info['tokenizedUrl'],
57 'description': get_element_by_attribute('class', 'text', webpage),
58 'thumbnail': info_el.find('thumb').text,
59 'duration': parse_duration(info_el.find('duration').text),