- url = video_data['url']
- # URL can be sometimes empty. Does this only happen when there is DRM?
- if url:
- formats = self._extract_m3u8_formats(
- self._proto_relative_url(url),
- video_id, 'mp4', 'm3u8_native')
- self._sort_formats(formats)
-
- thumbnails = []
- for thumbnail_url in video_data.get('thumbnails', []):
- if not thumbnail_url:
- continue
- thumbnails.append({
- 'url': self._proto_relative_url(thumbnail_url),
- })
+ drm_formats = False
+
+ for resource in traverse_obj(video_data, ('video_resources', lambda _, v: url_or_none(v['manifest']['url']))):
+ resource_type = resource.get('type')
+ manifest_url = resource['manifest']['url']
+ if resource_type == 'dash':
+ formats.extend(self._extract_mpd_formats(manifest_url, video_id, mpd_id=resource_type, fatal=False))
+ elif resource_type in ('hlsv3', 'hlsv6'):
+ formats.extend(self._extract_m3u8_formats(manifest_url, video_id, 'mp4', m3u8_id=resource_type, fatal=False))
+ elif resource_type in self._UNPLAYABLE_FORMATS:
+ drm_formats = True
+ else:
+ self.report_warning(f'Skipping unknown resource type "{resource_type}"')
+
+ if not formats and drm_formats:
+ self.report_drm(video_id)
+ elif not formats and not video_data.get('policy_match'): # policy_match is False if content was removed
+ raise ExtractorError('This content is currently unavailable', expected=True)