]> jfr.im git - yt-dlp.git/blobdiff - yt_dlp/extractor/corus.py
[ie/crunchyroll] Fix stream extraction (#10005)
[yt-dlp.git] / yt_dlp / extractor / corus.py
index e11aadf14fe960be6d9e8c583cf103f0b75ec057..bcc34ddd8a12f8c942b43ab091309345b91ddd48 100644 (file)
@@ -1,8 +1,3 @@
-# coding: utf-8
-from __future__ import unicode_literals
-
-import re
-
 from .theplatform import ThePlatformFeedIE
 from ..utils import (
     dict_get,
@@ -12,7 +7,7 @@
 )
 
 
-class CorusIE(ThePlatformFeedIE):
+class CorusIE(ThePlatformFeedIE):  # XXX: Do not subclass from concrete IE
     _VALID_URL = r'''(?x)
                     https?://
                         (?:www\.)?
@@ -46,7 +41,7 @@ class CorusIE(ThePlatformFeedIE):
                         )
                     '''
     _TESTS = [{
-        'url': 'http://www.hgtv.ca/shows/bryan-inc/videos/movie-night-popcorn-with-bryan-870923331648/',
+        'url': 'https://www.hgtv.ca/video/bryan-inc/movie-night-popcorn-with-bryan/870923331648/',
         'info_dict': {
             'id': '870923331648',
             'ext': 'mp4',
@@ -56,10 +51,10 @@ class CorusIE(ThePlatformFeedIE):
             'timestamp': 1486392197,
         },
         'params': {
-            'format': 'bestvideo',
             'skip_download': True,
         },
         'expected_warnings': ['Failed to parse JSON'],
+        # FIXME: yt-dlp wrongly raises for geo restriction
     }, {
         'url': 'http://www.foodnetwork.ca/shows/chopped/video/episode/chocolate-obsession/video.html?v=872683587753',
         'only_matching': True,
@@ -96,7 +91,7 @@ class CorusIE(ThePlatformFeedIE):
     }
 
     def _real_extract(self, url):
-        domain, video_id = re.match(self._VALID_URL, url).groups()
+        domain, video_id = self._match_valid_url(url).groups()
         site = domain.split('.')[0]
         path = self._SITE_MAP.get(site, site)
         if path != 'series':
@@ -131,8 +126,7 @@ def _real_extract(self, url):
             formats.extend(self._parse_smil_formats(
                 smil, smil_url, video_id, namespace))
         if not formats and video.get('drm'):
-            raise ExtractorError('This video is DRM protected.', expected=True)
-        self._sort_formats(formats)
+            self.report_drm(video_id)
 
         subtitles = {}
         for track in video.get('tracks', []):