]> jfr.im git - yt-dlp.git/blobdiff - yt_dlp/extractor/tvnow.py
[extractor/vimeo] Fix `playerConfig` extraction (#6203)
[yt-dlp.git] / yt_dlp / extractor / tvnow.py
index 9b90a2b26b31a749771add8c433f56ab41b03b00..0acc306df26ca9caa4f25daa7cf31f8709d4f5f6 100644 (file)
@@ -1,6 +1,3 @@
-# coding: utf-8
-from __future__ import unicode_literals
-
 import re
 
 from .common import InfoExtractor
@@ -69,7 +66,7 @@ def make_urls(proto, suffix):
             if formats:
                 break
         else:
-            if not self._downloader.params.get('allow_unplayable_formats') and info.get('isDrm'):
+            if not self.get_param('allow_unplayable_formats') and info.get('isDrm'):
                 raise ExtractorError(
                     'Video %s is DRM protected' % video_id, expected=True)
             if info.get('geoblocked'):
@@ -77,7 +74,6 @@ def make_urls(proto, suffix):
             if not info.get('free', True):
                 raise ExtractorError(
                     'Video %s is not available for free' % video_id, expected=True)
-        self._sort_formats(formats)
 
         description = info.get('articleLong') or info.get('articleShort')
         timestamp = parse_iso8601(info.get('broadcastStartDate'), ' ')
@@ -169,7 +165,7 @@ def suitable(cls, url):
     }]
 
     def _real_extract(self, url):
-        mobj = re.match(self._VALID_URL, url)
+        mobj = self._match_valid_url(url)
         display_id = '%s/%s' % mobj.group(2, 3)
 
         info = self._call_api(
@@ -196,7 +192,7 @@ class TVNowNewIE(InfoExtractor):
     }]
 
     def _real_extract(self, url):
-        mobj = re.match(self._VALID_URL, url)
+        mobj = self._match_valid_url(url)
         base_url = re.sub(r'(?:shows|serien)', '_', mobj.group('base_url'))
         show, episode = mobj.group('show', 'episode')
         return self.url_result(
@@ -243,7 +239,7 @@ class TVNowFilmIE(TVNowBaseIE):
     }]
 
     def _real_extract(self, url):
-        mobj = re.match(self._VALID_URL, url)
+        mobj = self._match_valid_url(url)
         display_id = mobj.group('title')
 
         webpage = self._download_webpage(url, display_id, fatal=False)
@@ -395,7 +391,6 @@ def url_repl(proto, suffix):
             if not info.get('free', True):
                 raise ExtractorError(
                     'Video %s is not available for free' % video_id, expected=True)
-        self._sort_formats(formats)
 
         description = source.get('description')
         thumbnail = url_or_none(source.get('poster'))
@@ -424,12 +419,12 @@ def url_repl(proto, suffix):
         }
 
     def _real_extract(self, url):
-        display_id, video_id = re.match(self._VALID_URL, url).groups()
+        display_id, video_id = self._match_valid_url(url).groups()
         info = self._call_api('player/' + video_id, video_id)
         return self._extract_video(info, video_id, display_id)
 
 
-class TVNowFilmIE(TVNowIE):
+class TVNowFilmIE(TVNowIE):  # XXX: Do not subclass from concrete IE
     _VALID_URL = r'''(?x)
                     (?P<base_url>https?://
                         (?:www\.)?tvnow\.(?:de|at|ch)/
@@ -466,7 +461,7 @@ class TVNowFilmIE(TVNowIE):
     }]
 
     def _real_extract(self, url):
-        mobj = re.match(self._VALID_URL, url)
+        mobj = self._match_valid_url(url)
         display_id = mobj.group('title')
 
         webpage = self._download_webpage(url, display_id, fatal=False)
@@ -552,7 +547,7 @@ class TVNowSeasonIE(TVNowListBaseIE):
     }]
 
     def _real_extract(self, url):
-        _, show_id, season_id = re.match(self._VALID_URL, url).groups()
+        _, show_id, season_id = self._match_valid_url(url).groups()
         return self._extract_items(
             url, show_id, season_id, {'season': season_id})
 
@@ -568,7 +563,7 @@ class TVNowAnnualIE(TVNowListBaseIE):
     }]
 
     def _real_extract(self, url):
-        _, show_id, year, month = re.match(self._VALID_URL, url).groups()
+        _, show_id, year, month = self._match_valid_url(url).groups()
         return self._extract_items(
             url, show_id, '%s-%s' % (year, month), {
                 'year': int(year),
@@ -600,7 +595,7 @@ def suitable(cls, url):
                 else super(TVNowShowIE, cls).suitable(url))
 
     def _real_extract(self, url):
-        base_url, show_id = re.match(self._VALID_URL, url).groups()
+        base_url, show_id = self._match_valid_url(url).groups()
 
         result = self._call_api(
             'teaserrow/format/navigation/' + show_id, show_id)