aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl
diff options
context:
space:
mode:
authorRemita Amine <remitamine@gmail.com>2020-12-29 14:05:23 +0100
committerRemita Amine <remitamine@gmail.com>2020-12-29 14:11:37 +0100
commitbcfe485e0172ff32c450bb7835cfae7fca7594ae (patch)
treec60f91833cec43600d582ce8a56de6d3ab7d47bb /youtube_dl
parent479cc6d5a166dc2f250687616041c9f3b36c80b4 (diff)
downloadyoutube-dl-bcfe485e0172ff32c450bb7835cfae7fca7594ae.tar.xz
[brightcove] raise ExtractorError for DRM protected videos(closes #23467)(closes #27568)
Diffstat (limited to 'youtube_dl')
-rw-r--r--youtube_dl/extractor/brightcove.py22
1 files changed, 15 insertions, 7 deletions
diff --git a/youtube_dl/extractor/brightcove.py b/youtube_dl/extractor/brightcove.py
index 65b44c099..6022076ac 100644
--- a/youtube_dl/extractor/brightcove.py
+++ b/youtube_dl/extractor/brightcove.py
@@ -471,13 +471,18 @@ class BrightcoveNewIE(AdobePassIE):
def _parse_brightcove_metadata(self, json_data, video_id, headers={}):
title = json_data['name'].strip()
+ num_drm_sources = 0
formats = []
- for source in json_data.get('sources', []):
+ sources = json_data.get('sources') or []
+ for source in sources:
container = source.get('container')
ext = mimetype2ext(source.get('type'))
src = source.get('src')
# https://support.brightcove.com/playback-api-video-fields-reference#key_systems_object
- if ext == 'ism' or container == 'WVM' or source.get('key_systems'):
+ if container == 'WVM' or source.get('key_systems'):
+ num_drm_sources += 1
+ continue
+ elif ext == 'ism':
continue
elif ext == 'm3u8' or container == 'M2TS':
if not src:
@@ -535,11 +540,14 @@ class BrightcoveNewIE(AdobePassIE):
})
formats.append(f)
- errors = json_data.get('errors')
- if not formats and errors:
- error = errors[0]
- raise ExtractorError(
- error.get('message') or error.get('error_subcode') or error['error_code'], expected=True)
+ if not formats:
+ errors = json_data.get('errors')
+ if errors:
+ error = errors[0]
+ raise ExtractorError(
+ error.get('message') or error.get('error_subcode') or error['error_code'], expected=True)
+ if sources and num_drm_sources == len(sources):
+ raise ExtractorError('This video is DRM protected.', expected=True)
self._sort_formats(formats)