]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/telegraaf.py
58078c531d151e319fb7e707d8116a730507962b
2 from __future__
import unicode_literals
4 from .common
import InfoExtractor
11 class TelegraafIE(InfoExtractor
):
12 _VALID_URL
= r
'https?://(?:www\.)?telegraaf\.nl/tv/(?:[^/]+/)+(?P<id>\d+)/[^/]+\.html'
14 'url': 'http://www.telegraaf.nl/tv/nieuws/binnenland/24353229/__Tikibad_ontruimd_wegens_brand__.html',
18 'title': 'Tikibad ontruimd wegens brand',
19 'description': 'md5:05ca046ff47b931f9b04855015e163a4',
20 'thumbnail': 're:^https?://.*\.jpg$',
25 'skip_download': True,
29 def _real_extract(self
, url
):
30 video_id
= self
._match
_id
(url
)
32 webpage
= self
._download
_webpage
(url
, video_id
)
34 player_url
= self
._html
_search
_regex
(
35 r
'<iframe[^>]+src="([^"]+")', webpage
, 'player URL')
36 player_page
= self
._download
_webpage
(
37 player_url
, video_id
, note
='Download player webpage')
38 playlist_url
= self
._search
_regex
(
39 r
'playlist\s*:\s*"([^"]+)"', player_page
, 'playlist URL')
40 playlist_data
= self
._download
_json
(playlist_url
, video_id
)
42 item
= playlist_data
['items'][0]
44 locations
= item
['locations']
45 for location
in locations
.get('adaptive', []):
46 manifest_url
= location
['src']
47 ext
= determine_ext(manifest_url
)
49 formats
.extend(self
._extract
_m
3u8_formats
(
50 manifest_url
, video_id
, ext
='mp4', m3u8_id
='hls', fatal
=False))
52 formats
.extend(self
._extract
_mpd
_formats
(
53 manifest_url
, video_id
, mpd_id
='dash', fatal
=False))
55 self
.report_warning('Unknown adaptive format %s' % ext
)
56 for location
in locations
.get('progressive', []):
58 'url': location
['sources'][0]['src'],
59 'width': location
.get('width'),
60 'height': location
.get('height'),
61 'format_id': 'http-%s' % location
['label'],
64 self
._sort
_formats
(formats
)
66 title
= remove_end(self
._og
_search
_title
(webpage
), ' - VIDEO')
67 description
= self
._og
_search
_description
(webpage
)
68 duration
= item
.get('duration')
69 thumbnail
= item
.get('poster')
74 'description': description
,
77 'thumbnail': thumbnail
,