aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/npo.py
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2019-03-23 21:43:50 +0700
committerSergey M․ <dstftw@gmail.com>2019-03-23 21:43:50 +0700
commit8cb10807ed6c6aa8e0f316b3f1a31a91df46abdb (patch)
treef4642a6bd58210b5fb3c8bb11f630c6afe4c7d5a /youtube_dl/extractor/npo.py
parentb8526c78f9a8a9101c5fd365f07c12e7b53c5ed9 (diff)
[npo] Improve DRM detection
Diffstat (limited to 'youtube_dl/extractor/npo.py')
-rw-r--r--youtube_dl/extractor/npo.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/youtube_dl/extractor/npo.py b/youtube_dl/extractor/npo.py
index ad62f8ec6..e525ad928 100644
--- a/youtube_dl/extractor/npo.py
+++ b/youtube_dl/extractor/npo.py
@@ -181,10 +181,7 @@ class NPOIE(NPOBaseIE):
def _real_extract(self, url):
video_id = self._match_id(url)
- try:
- return self._get_info(url, video_id)
- except ExtractorError:
- return self._get_old_info(video_id)
+ return self._get_info(url, video_id) or self._get_old_info(video_id)
def _get_info(self, url, video_id):
token = self._download_json(
@@ -206,6 +203,7 @@ class NPOIE(NPOBaseIE):
player_token = player['token']
+ drm = False
format_urls = set()
formats = []
for profile in ('hls', 'dash-widevine', 'dash-playready', 'smooth'):
@@ -227,7 +225,8 @@ class NPOIE(NPOBaseIE):
if not stream_url or stream_url in format_urls:
continue
format_urls.add(stream_url)
- if stream.get('protection') is not None:
+ if stream.get('protection') is not None or stream.get('keySystemOptions') is not None:
+ drm = True
continue
stream_type = stream.get('type')
stream_ext = determine_ext(stream_url)
@@ -246,6 +245,11 @@ class NPOIE(NPOBaseIE):
'url': stream_url,
})
+ if not formats:
+ if drm:
+ raise ExtractorError('This video is DRM protected.', expected=True)
+ return
+
self._sort_formats(formats)
info = {