]> jfr.im git - yt-dlp.git/commitdiff
[youtube] Detect DRM better
authorshirt <redacted>
Sun, 27 Mar 2022 05:28:26 +0000 (01:28 -0400)
committerpukkandan <redacted>
Sun, 27 Mar 2022 05:57:27 +0000 (11:27 +0530)
Authored by: shirt-dev

yt_dlp/extractor/youtube.py

index 0726e27b4697d10f8b86e8a6697c74313e0aed53..bd3a7d36bbe778a4861b6d2c115bb8fd478b6896 100644 (file)
@@ -3023,7 +3023,7 @@ def _extract_formats(self, streaming_data, video_id, player_url, is_live, durati
         streaming_formats = traverse_obj(streaming_data, (..., ('formats', 'adaptiveFormats'), ...), default=[])
 
         for fmt in streaming_formats:
-            if fmt.get('targetDurationSec') or fmt.get('drmFamilies'):
+            if fmt.get('targetDurationSec'):
                 continue
 
             itag = str_or_none(fmt.get('itag'))
@@ -3105,6 +3105,7 @@ def _extract_formats(self, streaming_data, video_id, player_url, is_live, durati
                 'fps': int_or_none(fmt.get('fps')) or None,
                 'height': height,
                 'quality': q(quality),
+                'has_drm': bool(fmt.get('drmFamilies')),
                 'tbr': tbr,
                 'url': fmt_url,
                 'width': int_or_none(fmt.get('width')),