From 6e077446cdcc5df0d03a1a6e6d88985021d84812 Mon Sep 17 00:00:00 2001 From: BGarber42 Date: Wed, 7 Feb 2024 04:35:12 +0100 Subject: [PATCH] Add DRM test case --- yt_dlp/extractor/kanopy.py | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/yt_dlp/extractor/kanopy.py b/yt_dlp/extractor/kanopy.py index e55c02357326..f051700bef52 100644 --- a/yt_dlp/extractor/kanopy.py +++ b/yt_dlp/extractor/kanopy.py @@ -17,6 +17,21 @@ class KanopyIE(InfoExtractor): "title": "The Blue Kite", "description": "md5:6163af52ae92627ae7c58906991d3792", }, + }, + { + "url": "https://www.kanopy.com/en/pleasantvalley/watch/video/14020947", + "info_dict": { + "id": "14020947", + "ext": "mpd", + "title": "The Whale", + "description": "TBD", + }, + "params": { + "ignore_no_formats_error": True, + "skip_download": True, + }, + "expected_warnings": ["This video is DRM protected"], + "expected_exception": "DownloadError", } ] _LOGIN_REQUIRED = True @@ -38,7 +53,7 @@ def _perform_login(self, username, password): access_json = self._download_json( self._API_BASE_URL + "login", None, - "Logging in", + "Logging in to site using credentials", "Unable to log in", fatal=False, headers=self.headers, @@ -87,6 +102,13 @@ def _real_extract(self, url): ).encode(), ) + manifests = streams["manifests"] + drm_free = bool(list(filter(lambda x: 'drm' in x and x['drm'] == 'none', manifests))) + + self.write_debug(f"Params: {self._downloader.params}") + if not drm_free: + self.report_drm(video_id) + return { "id": video_id, "title": video_info["video"]["title"],