1 from .common
import InfoExtractor
2 from ..networking
import Request
11 class EitbIE(InfoExtractor
):
13 _VALID_URL
= r
'https?://(?:www\.)?eitb\.tv/(?:eu/bideoa|es/video)/[^/]+/\d+/(?P<id>\d+)'
16 'url': 'http://www.eitb.tv/es/video/60-minutos-60-minutos-2013-2014/4104995148001/4090227752001/lasa-y-zabala-30-anos/',
17 'md5': 'edf4436247185adee3ea18ce64c47998',
19 'id': '4090227752001',
21 'title': '60 minutos (Lasa y Zabala, 30 aƱos)',
22 'description': 'Programa de reportajes de actualidad.',
24 'timestamp': 1381789200,
25 'upload_date': '20131014',
30 def _real_extract(self
, url
):
31 video_id
= self
._match
_id
(url
)
33 video
= self
._download
_json
(
34 f
'http://mam.eitb.eus/mam/REST/ServiceMultiweb/Video/MULTIWEBTV/{video_id}/',
35 video_id
, 'Downloading video JSON')
37 media
= video
['web_media'][0]
40 for rendition
in media
['RENDITIONS']:
41 video_url
= rendition
.get('PMD_URL')
44 tbr
= float_or_none(rendition
.get('ENCODING_RATE'), 1000)
46 'url': rendition
['PMD_URL'],
47 'format_id': join_nonempty('http', int_or_none(tbr
)),
48 'width': int_or_none(rendition
.get('FRAME_WIDTH')),
49 'height': int_or_none(rendition
.get('FRAME_HEIGHT')),
53 hls_url
= media
.get('HLS_SURL')
56 'http://mam.eitb.eus/mam/REST/ServiceMultiweb/DomainRestrictedSecurity/TokenAuth/',
57 headers
={'Referer': url
})
58 token_data
= self
._download
_json
(
59 request
, video_id
, 'Downloading auth token', fatal
=False)
61 token
= token_data
.get('token')
63 formats
.extend(self
._extract
_m
3u8_formats
(
64 f
'{hls_url}?hdnts={token}', video_id
, m3u8_id
='hls', fatal
=False))
66 hds_url
= media
.get('HDS_SURL')
68 formats
.extend(self
._extract
_f
4m
_formats
(
69 '{}?hdcore=3.7.0'.format(hds_url
.replace('euskalsvod', 'euskalvod')),
70 video_id
, f4m_id
='hds', fatal
=False))
74 'title': media
.get('NAME_ES') or media
.get('name') or media
['NAME_EU'],
75 'description': media
.get('SHORT_DESC_ES') or video
.get('desc_group') or media
.get('SHORT_DESC_EU'),
76 'thumbnail': media
.get('STILL_URL') or media
.get('THUMBNAIL_URL'),
77 'duration': float_or_none(media
.get('LENGTH'), 1000),
78 'timestamp': parse_iso8601(media
.get('BROADCST_DATE'), ' '),
79 'tags': media
.get('TAGS'),