]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/eitb.py
713cb7b329208d3c761b12858cc265b401c16dd0
2 from __future__
import unicode_literals
4 from .common
import InfoExtractor
13 class EitbIE(InfoExtractor
):
15 _VALID_URL
= r
'https?://(?:www\.)?eitb\.tv/(?:eu/bideoa|es/video)/[^/]+/\d+/(?P<id>\d+)'
18 'url': 'http://www.eitb.tv/es/video/60-minutos-60-minutos-2013-2014/4104995148001/4090227752001/lasa-y-zabala-30-anos/',
19 'md5': 'edf4436247185adee3ea18ce64c47998',
21 'id': '4090227752001',
23 'title': '60 minutos (Lasa y Zabala, 30 años)',
24 'description': 'Programa de reportajes de actualidad.',
26 'timestamp': 1381789200,
27 'upload_date': '20131014',
32 def _real_extract(self
, url
):
33 video_id
= self
._match
_id
(url
)
35 video
= self
._download
_json
(
36 'http://mam.eitb.eus/mam/REST/ServiceMultiweb/Video/MULTIWEBTV/%s/' % video_id
,
37 video_id
, 'Downloading video JSON')
39 media
= video
['web_media'][0]
42 for rendition
in media
['RENDITIONS']:
43 video_url
= rendition
.get('PMD_URL')
46 tbr
= float_or_none(rendition
.get('ENCODING_RATE'), 1000)
49 format_id
+= '-%d' % int(tbr
)
51 'url': rendition
['PMD_URL'],
52 'format_id': format_id
,
53 'width': int_or_none(rendition
.get('FRAME_WIDTH')),
54 'height': int_or_none(rendition
.get('FRAME_HEIGHT')),
58 hls_url
= media
.get('HLS_SURL')
60 request
= sanitized_Request(
61 'http://mam.eitb.eus/mam/REST/ServiceMultiweb/DomainRestrictedSecurity/TokenAuth/',
62 headers
={'Referer': url
})
63 token_data
= self
._download
_json
(
64 request
, video_id
, 'Downloading auth token', fatal
=False)
66 token
= token_data
.get('token')
68 formats
.extend(self
._extract
_m
3u8_formats
(
69 '%s?hdnts=%s' % (hls_url
, token
), video_id
, m3u8_id
='hls', fatal
=False))
71 hds_url
= media
.get('HDS_SURL')
73 formats
.extend(self
._extract
_f
4m
_formats
(
74 '%s?hdcore=3.7.0' % hds_url
.replace('euskalsvod', 'euskalvod'),
75 video_id
, f4m_id
='hds', fatal
=False))
77 self
._sort
_formats
(formats
)
81 'title': media
.get('NAME_ES') or media
.get('name') or media
['NAME_EU'],
82 'description': media
.get('SHORT_DESC_ES') or video
.get('desc_group') or media
.get('SHORT_DESC_EU'),
83 'thumbnail': media
.get('STILL_URL') or media
.get('THUMBNAIL_URL'),
84 'duration': float_or_none(media
.get('LENGTH'), 1000),
85 'timestamp': parse_iso8601(media
.get('BROADCST_DATE'), ' '),
86 'tags': media
.get('TAGS'),