aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2022-03-27 11:38:26 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2022-03-27 11:39:35 +0530
commitc0b6e5c74d59d5260441ceaeb5dac3626780b31b (patch)
tree5e4f1cbead80e6efaa99c39cd8dc537d205f9b22
parent727029c50889d4c36dcfcffa2be6cdec309edf56 (diff)
downloadhypervideo-pre-c0b6e5c74d59d5260441ceaeb5dac3626780b31b.tar.lz
hypervideo-pre-c0b6e5c74d59d5260441ceaeb5dac3626780b31b.tar.xz
hypervideo-pre-c0b6e5c74d59d5260441ceaeb5dac3626780b31b.zip
Show warning when all media formats have DRM
Related: #1379
-rw-r--r--yt_dlp/YoutubeDL.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/yt_dlp/YoutubeDL.py b/yt_dlp/YoutubeDL.py
index c2f4f3a95..434bef65f 100644
--- a/yt_dlp/YoutubeDL.py
+++ b/yt_dlp/YoutubeDL.py
@@ -2459,6 +2459,11 @@ class YoutubeDL(object):
info_dict['__has_drm'] = any(f.get('has_drm') for f in formats)
if not self.params.get('allow_unplayable_formats'):
formats = [f for f in formats if not f.get('has_drm')]
+ if info_dict['__has_drm'] and all(
+ f.get('acodec') == f.get('vcodec') == 'none' for f in formats):
+ self.report_warning(
+ 'This video is DRM protected and only images are available for download. '
+ 'Use --list-formats to see them')
get_from_start = not info_dict.get('is_live') or bool(self.params.get('live_from_start'))
if not get_from_start:
@@ -2631,8 +2636,9 @@ class YoutubeDL(object):
if not formats_to_download:
if not self.params.get('ignore_no_formats_error'):
- raise ExtractorError('Requested format is not available', expected=True,
- video_id=info_dict['id'], ie=info_dict['extractor'])
+ raise ExtractorError(
+ 'Requested format is not available. Use --list-formats for a list of available formats',
+ expected=True, video_id=info_dict['id'], ie=info_dict['extractor'])
self.report_warning('Requested format is not available')
# Process what we can, even without any available formats.
formats_to_download = [{}]