Skip to content

Commit

Permalink
Add DRM test case
Browse files Browse the repository at this point in the history
  • Loading branch information
BGarber42 committed Feb 7, 2024
1 parent bc3747e commit 6e07744
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion yt_dlp/extractor/kanopy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down Expand Up @@ -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"],
Expand Down

0 comments on commit 6e07744

Please sign in to comment.