mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-12-22 16:57:40 +00:00
[tv2] detect DRM protection
This commit is contained in:
parent
8d3a3a9901
commit
0b25af9bf5
1 changed files with 7 additions and 4 deletions
|
@ -79,9 +79,10 @@ class TV2IE(InfoExtractor):
|
||||||
formats.extend(self._extract_f4m_formats(
|
formats.extend(self._extract_f4m_formats(
|
||||||
video_url, video_id, f4m_id=format_id, fatal=False))
|
video_url, video_id, f4m_id=format_id, fatal=False))
|
||||||
elif ext == 'm3u8':
|
elif ext == 'm3u8':
|
||||||
formats.extend(self._extract_m3u8_formats(
|
if not data.get('drmProtected'):
|
||||||
video_url, video_id, 'mp4', entry_protocol='m3u8_native',
|
formats.extend(self._extract_m3u8_formats(
|
||||||
m3u8_id=format_id, fatal=False))
|
video_url, video_id, 'mp4', entry_protocol='m3u8_native',
|
||||||
|
m3u8_id=format_id, fatal=False))
|
||||||
elif ext == 'mpd':
|
elif ext == 'mpd':
|
||||||
formats.extend(self._extract_mpd_formats(
|
formats.extend(self._extract_mpd_formats(
|
||||||
video_url, video_id, format_id, fatal=False))
|
video_url, video_id, format_id, fatal=False))
|
||||||
|
@ -94,6 +95,8 @@ class TV2IE(InfoExtractor):
|
||||||
'tbr': int_or_none(item.get('bitrate')),
|
'tbr': int_or_none(item.get('bitrate')),
|
||||||
'filesize': int_or_none(item.get('fileSize')),
|
'filesize': int_or_none(item.get('fileSize')),
|
||||||
})
|
})
|
||||||
|
if not formats and data.get('drmProtected'):
|
||||||
|
raise ExtractorError('This video is DRM protected.', expected=True)
|
||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
|
|
||||||
asset = self._download_json(
|
asset = self._download_json(
|
||||||
|
@ -104,7 +107,7 @@ class TV2IE(InfoExtractor):
|
||||||
thumbnails = [{
|
thumbnails = [{
|
||||||
'id': thumbnail.get('@type'),
|
'id': thumbnail.get('@type'),
|
||||||
'url': thumbnail.get('url'),
|
'url': thumbnail.get('url'),
|
||||||
} for _, thumbnail in asset.get('imageVersions', {}).items()]
|
} for _, thumbnail in (asset.get('imageVersions') or {}).items()]
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
|
|
Loading…
Reference in a new issue