about summary refs log tree commit diff
diff options
context:
space:
mode:
authornixxo <nixxo@protonmail.com>2021-01-04 15:11:47 +0100
committerdirkf <fieldhouse@gmx.net>2022-04-05 15:21:59 +0100
commit9e5ca66f16998eb2a680e23a6e769e34001898c5 (patch)
tree7755df25ac40001604b6680aeccf19200d864d89
parent17d295a1ec6d04362740dd8a0c583690f5ba082a (diff)
downloadyoutube-dl-9e5ca66f16998eb2a680e23a6e769e34001898c5.tar.gz
youtube-dl-9e5ca66f16998eb2a680e23a6e769e34001898c5.tar.xz
youtube-dl-9e5ca66f16998eb2a680e23a6e769e34001898c5.zip
[RAI] Added checks for DRM protected content (PR #27657)
reviewed by pukkandan (https://github.com/yt-dlp/yt-dlp/pull/150)
-rw-r--r--youtube_dl/extractor/rai.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/youtube_dl/extractor/rai.py b/youtube_dl/extractor/rai.py
index 67b86fc72..2abe164e0 100644
--- a/youtube_dl/extractor/rai.py
+++ b/youtube_dl/extractor/rai.py
@@ -158,6 +158,10 @@ class RaiPlayIE(RaiBaseIE):
         # subtitles at 'subtitlesArray' key (see #27698)
         'url': 'https://www.raiplay.it/video/2020/12/Report---04-01-2021-2e90f1de-8eee-4de4-ac0e-78d21db5b600.html',
         'only_matching': True,
+    }, {
+        # DRM protected
+        'url': 'https://www.raiplay.it/video/2020/09/Lo-straordinario-mondo-di-Zoey-S1E1-Lo-straordinario-potere-di-Zoey-ed493918-1d32-44b7-8454-862e473d00ff.html',
+        'only_matching': True,
     }]
 
     def _real_extract(self, url):
@@ -166,6 +170,13 @@ class RaiPlayIE(RaiBaseIE):
         media = self._download_json(
             base + '.json', video_id, 'Downloading video JSON')
 
+        if try_get(
+                media,
+                (lambda x: x['rights_management']['rights']['drm'],
+                 lambda x: x['program_info']['rights_management']['rights']['drm']),
+                dict):
+            raise ExtractorError('This video is DRM protected.', expected=True)
+
         title = media['name']
 
         video = media['video']