2 from __future__ import unicode_literals
4 from .common import InfoExtractor
13 class TelegraafIE(InfoExtractor):
14 _VALID_URL = r'https?://(?:www\.)?telegraaf\.nl/video/(?P<id>\d+)'
16 'url': 'https://www.telegraaf.nl/video/734366489/historisch-scheepswrak-slaat-na-100-jaar-los',
20 'title': 'Historisch scheepswrak slaat na 100 jaar los',
21 'description': 'md5:6f53b7c4f55596722ac24d6c0ec00cfb',
22 'thumbnail': r're:^https?://.*\.jpg',
24 'timestamp': 1572805527,
25 'upload_date': '20191103',
29 'skip_download': True,
33 def _real_extract(self, url):
34 article_id = self._match_id(url)
36 video_id = self._download_json(
37 'https://www.telegraaf.nl/graphql', article_id, query={
45 })['data']['article']['videos'][0]['videoId']
47 item = self._download_json(
48 'https://content.tmgvideo.nl/playlist/item=%s/playlist.json' % video_id,
53 locations = item.get('locations') or {}
54 for location in locations.get('adaptive', []):
55 manifest_url = location.get('src')
58 ext = determine_ext(manifest_url)
60 formats.extend(self._extract_m3u8_formats(
61 manifest_url, video_id, ext='mp4', m3u8_id='hls', fatal=False))
63 formats.extend(self._extract_mpd_formats(
64 manifest_url, video_id, mpd_id='dash', fatal=False))
66 self.report_warning('Unknown adaptive format %s' % ext)
67 for location in locations.get('progressive', []):
68 src = try_get(location, lambda x: x['sources'][0]['src'])
71 label = location.get('label')
74 'width': int_or_none(location.get('width')),
75 'height': int_or_none(location.get('height')),
76 'format_id': 'http' + ('-%s' % label if label else ''),
79 self._sort_formats(formats)
84 'description': item.get('description'),
86 'duration': int_or_none(item.get('duration')),
87 'thumbnail': item.get('poster'),
88 'timestamp': parse_iso8601(item.get('datecreated'), ' '),