1 from __future__ import unicode_literals
3 from .common import InfoExtractor
4 from ..compat import compat_urllib_parse
7 get_element_by_attribute,
12 class MiTeleIE(InfoExtractor):
14 _VALID_URL = r'http://www\.mitele\.es/[^/]+/[^/]+/[^/]+/(?P<id>[^/]+)/'
17 'url': 'http://www.mitele.es/programas-tv/diario-de/la-redaccion/programa-144/',
18 'md5': '757b0b66cbd7e0a97226d7d3156cb3e9',
20 'id': '0NF1jJnxS1Wu3pHrmvFyw2',
21 'display_id': 'programa-144',
23 'title': 'Tor, la web invisible',
24 'description': 'md5:3b6fce7eaa41b2d97358726378d9369f',
25 'thumbnail': 're:(?i)^https?://.*\.jpg$',
30 def _real_extract(self, url):
31 display_id = self._match_id(url)
33 webpage = self._download_webpage(url, display_id)
35 config_url = self._search_regex(
36 r'data-config\s*=\s*"([^"]+)"', webpage, 'data config url')
38 config = self._download_json(
39 config_url, display_id, 'Downloading config JSON')
41 mmc = self._download_json(
42 config['services']['mmc'], display_id, 'Downloading mmc JSON')
45 for location in mmc['locations']:
46 gat = self._proto_relative_url(location.get('gat'), 'http:')
47 bas = location.get('bas')
48 loc = location.get('loc')
49 ogn = location.get('ogn')
50 if None in (gat, bas, loc, ogn):
58 media = self._download_json(
59 '%s/?%s' % (gat, compat_urllib_parse.urlencode(encode_dict(token_data))),
60 display_id, 'Downloading %s JSON' % location['loc'])
61 file_ = media.get('file')
64 formats.extend(self._extract_f4m_formats(
65 file_ + '&hdcore=3.2.0&plugin=aasp-3.2.0.77.18',
66 display_id, f4m_id=loc))
68 title = self._search_regex(
69 r'class="Destacado-text"[^>]*>\s*<strong>([^<]+)</strong>', webpage, 'title')
71 video_id = self._search_regex(
72 r'data-media-id\s*=\s*"([^"]+)"', webpage,
73 'data media id', default=None) or display_id
74 thumbnail = config.get('poster', {}).get('imageUrl')
75 duration = int_or_none(mmc.get('duration'))
79 'display_id': display_id,
81 'description': get_element_by_attribute('class', 'text', webpage),
82 'thumbnail': thumbnail,