Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[rai] drm check and fix #27657

Closed
wants to merge 9 commits into from
12 changes: 11 additions & 1 deletion youtube_dl/extractor/rai.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@ class RaiPlayIE(RaiBaseIE):
}, {
'url': 'http://www.raiplay.it/video/2016/11/gazebotraindesi-efebe701-969c-4593-92f3-285f0d1ce750.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,
}, {
# subtitles at 'subtitlesArray' key (see #27698)
'url': 'https://www.raiplay.it/video/2020/12/Report---04-01-2021-2e90f1de-8eee-4de4-ac0e-78d21db5b600.html',
Expand All @@ -166,8 +170,14 @@ def _real_extract(self, url):
media = self._download_json(
base + '.json', video_id, 'Downloading video JSON')

title = media['name']
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']

relinker_info = self._extract_relinker_info(video['content_url'], video_id)
Expand Down