]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/mitele.py
c595f20775efd8e4aed348e4886ac55209e2c6e2
1 from __future__
import unicode_literals
3 from .common
import InfoExtractor
10 get_element_by_attribute
,
15 class MiTeleIE(InfoExtractor
):
17 _VALID_URL
= r
'http://www\.mitele\.es/[^/]+/[^/]+/[^/]+/(?P<id>[^/]+)/'
20 'url': 'http://www.mitele.es/programas-tv/diario-de/la-redaccion/programa-144/',
21 'md5': '0ff1a13aebb35d9bc14081ff633dd324',
23 'id': '0NF1jJnxS1Wu3pHrmvFyw2',
24 'display_id': 'programa-144',
26 'title': 'Tor, la web invisible',
27 'description': 'md5:3b6fce7eaa41b2d97358726378d9369f',
28 'thumbnail': 're:(?i)^https?://.*\.jpg$',
33 def _real_extract(self
, url
):
34 display_id
= self
._match
_id
(url
)
36 webpage
= self
._download
_webpage
(url
, display_id
)
38 config_url
= self
._search
_regex
(
39 r
'data-config\s*=\s*"([^"]+)"', webpage
, 'data config url')
40 config_url
= compat_urlparse
.urljoin(url
, config_url
)
42 config
= self
._download
_json
(
43 config_url
, display_id
, 'Downloading config JSON')
45 mmc
= self
._download
_json
(
46 config
['services']['mmc'], display_id
, 'Downloading mmc JSON')
49 for location
in mmc
['locations']:
50 gat
= self
._proto
_relative
_url
(location
.get('gat'), 'http:')
51 bas
= location
.get('bas')
52 loc
= location
.get('loc')
53 ogn
= location
.get('ogn')
54 if None in (gat
, bas
, loc
, ogn
):
62 media
= self
._download
_json
(
63 '%s/?%s' % (gat
, compat_urllib_parse
.urlencode(encode_dict(token_data
))),
64 display_id
, 'Downloading %s JSON' % location
['loc'])
65 file_
= media
.get('file')
68 formats
.extend(self
._extract
_f
4m
_formats
(
69 file_
+ '&hdcore=3.2.0&plugin=aasp-3.2.0.77.18',
70 display_id
, f4m_id
=loc
))
72 title
= self
._search
_regex
(
73 r
'class="Destacado-text"[^>]*>\s*<strong>([^<]+)</strong>', webpage
, 'title')
75 video_id
= self
._search
_regex
(
76 r
'data-media-id\s*=\s*"([^"]+)"', webpage
,
77 'data media id', default
=None) or display_id
78 thumbnail
= config
.get('poster', {}).get('imageUrl')
79 duration
= int_or_none(mmc
.get('duration'))
83 'display_id': display_id
,
85 'description': get_element_by_attribute('class', 'text', webpage
),
86 'thumbnail': thumbnail
,