about summary refs log tree commit diff
path: root/youtube_dl/extractor/wakanim.py
diff options
context:
space:
mode:
authorRemita Amine <remitamine@gmail.com>2019-01-26 22:52:54 +0100
committerRemita Amine <remitamine@gmail.com>2019-01-26 22:53:09 +0100
commit30cd1a5f3920d7485225a5d57b6ce41be4cde672 (patch)
tree6eb3651bc6a7886ed7131c13f55a01494b7a5e20 /youtube_dl/extractor/wakanim.py
parent458fd30f56785d514862dcb8a604a329d8e29ec6 (diff)
downloadyoutube-dl-30cd1a5f3920d7485225a5d57b6ce41be4cde672.tar.gz
youtube-dl-30cd1a5f3920d7485225a5d57b6ce41be4cde672.tar.xz
youtube-dl-30cd1a5f3920d7485225a5d57b6ce41be4cde672.zip
[wakanim] detect DRM protected videos
Diffstat (limited to 'youtube_dl/extractor/wakanim.py')
-rw-r--r--youtube_dl/extractor/wakanim.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/youtube_dl/extractor/wakanim.py b/youtube_dl/extractor/wakanim.py
index 1d588bdd6..f9a2395d9 100644
--- a/youtube_dl/extractor/wakanim.py
+++ b/youtube_dl/extractor/wakanim.py
@@ -3,6 +3,7 @@ from __future__ import unicode_literals
 
 from .common import InfoExtractor
 from ..utils import (
+    ExtractorError,
     merge_dicts,
     urljoin,
 )
@@ -10,7 +11,7 @@ from ..utils import (
 
 class WakanimIE(InfoExtractor):
     _VALID_URL = r'https://(?:www\.)?wakanim\.tv/[^/]+/v2/catalogue/episode/(?P<id>\d+)'
-    _TEST = {
+    _TESTS = [{
         'url': 'https://www.wakanim.tv/de/v2/catalogue/episode/2997/the-asterisk-war-omu-staffel-1-episode-02-omu',
         'info_dict': {
             'id': '2997',
@@ -26,7 +27,11 @@ class WakanimIE(InfoExtractor):
             'format': 'bestvideo',
             'skip_download': True,
         },
-    }
+    }, {
+        # DRM Protected
+        'url': 'https://www.wakanim.tv/de/v2/catalogue/episode/7843/sword-art-online-alicization-omu-arc-2-folge-15-omu',
+        'only_matching': True,
+    }]
 
     def _real_extract(self, url):
         video_id = self._match_id(url)
@@ -36,6 +41,12 @@ class WakanimIE(InfoExtractor):
         m3u8_url = urljoin(url, self._search_regex(
             r'file\s*:\s*(["\'])(?P<url>(?:(?!\1).)+)\1', webpage, 'm3u8 url',
             group='url'))
+        # https://docs.microsoft.com/en-us/azure/media-services/previous/media-services-content-protection-overview#streaming-urls
+        encryption = self._search_regex(
+            r'encryption%3D(c(?:enc|bc(?:s-aapl)?))',
+            m3u8_url, 'encryption', default=None)
+        if encryption and encryption in ('cenc', 'cbcs-aapl'):
+            raise ExtractorError('This video is DRM protected.', expected=True)
 
         formats = self._extract_m3u8_formats(
             m3u8_url, video_id, 'mp4', entry_protocol='m3u8_native',