]> jfr.im git - yt-dlp.git/blobdiff - yt_dlp/extractor/npo.py
[extractor] Deprecate `_sort_formats`
[yt-dlp.git] / yt_dlp / extractor / npo.py
index 573a89092cdf0cef4495238d4f07cece8456f083..f18cb9e28b22853ecffd596389c3c9910d7e350b 100644 (file)
@@ -1,5 +1,3 @@
-from __future__ import unicode_literals
-
 import re
 
 from .common import InfoExtractor
@@ -246,11 +244,8 @@ def _get_info(self, url, video_id):
                 })
 
         if not formats:
-            if not self._downloader.params.get('allow_unplayable_formats') and drm:
-                self.raise_no_formats('This video is DRM protected.', expected=True)
-            return
-
-        self._sort_formats(formats)
+            if not self.get_param('allow_unplayable_formats') and drm:
+                self.report_drm(video_id)
 
         info = {
             'id': video_id,
@@ -457,8 +452,6 @@ def add_format_url(format_url):
                         'quality': stream.get('kwaliteit'),
                     })
 
-        self._sort_formats(formats)
-
         subtitles = {}
         if metadata.get('tt888') == 'ja':
             subtitles['nl'] = [{
@@ -468,7 +461,7 @@ def add_format_url(format_url):
 
         return {
             'id': video_id,
-            'title': self._live_title(title) if is_live else title,
+            'title': title,
             'description': metadata.get('info'),
             'thumbnail': metadata.get('images', [{'url': None}])[-1]['url'],
             'upload_date': unified_strdate(metadata.get('gidsdatum')),
@@ -562,7 +555,7 @@ def _real_extract(self, url):
         return {
             'id': video_id,
             'url': stream['url'],
-            'title': self._live_title(title),
+            'title': title,
             'acodec': codec,
             'ext': codec,
             'is_live': True,
@@ -602,7 +595,7 @@ def _real_extract(self, url):
         }
 
 
-class NPODataMidEmbedIE(InfoExtractor):
+class NPODataMidEmbedIE(InfoExtractor):  # XXX: Conventionally, base classes should end with BaseIE/InfoExtractor
     def _real_extract(self, url):
         display_id = self._match_id(url)
         webpage = self._download_webpage(url, display_id)
@@ -656,7 +649,7 @@ class HetKlokhuisIE(NPODataMidEmbedIE):
     }
 
 
-class NPOPlaylistBaseIE(NPOIE):
+class NPOPlaylistBaseIE(NPOIE):  # XXX: Do not subclass from concrete IE
     def _real_extract(self, url):
         playlist_id = self._match_id(url)