]> jfr.im git - yt-dlp.git/blobdiff - yt_dlp/extractor/voicy.py
[extractor] Deprecate `_sort_formats`
[yt-dlp.git] / yt_dlp / extractor / voicy.py
index ae29c3de2dd368abcb4516dea92f64f8b3199c61..7438b49565b5e75c58ba94400d4605802e1cdbb7 100644 (file)
@@ -1,19 +1,16 @@
-# coding: utf-8
-from __future__ import unicode_literals
+import itertools
 
 from .common import InfoExtractor
 from ..compat import compat_str
 from ..utils import (
     ExtractorError,
     smuggle_url,
+    str_or_none,
     traverse_obj,
-    unsmuggle_url,
     unified_strdate,
+    unsmuggle_url,
 )
 
-import re
-import itertools
-
 
 class VoicyBaseIE(InfoExtractor):
     def _extract_from_playlist_data(self, value):
@@ -26,9 +23,9 @@ def _extract_from_playlist_data(self, value):
             'id': voice_id,
             'title': compat_str(value.get('PlaylistName')),
             'uploader': value.get('SpeakerName'),
-            'uploader_id': compat_str(value.get('SpeakerId')),
+            'uploader_id': str_or_none(value.get('SpeakerId')),
             'channel': value.get('ChannelName'),
-            'channel_id': compat_str(value.get('ChannelId')),
+            'channel_id': str_or_none(value.get('ChannelId')),
             'upload_date': upload_date,
         }
 
@@ -47,7 +44,6 @@ def _extract_single_article(self, entry):
             'acodec': 'mp3',
             'vcodec': 'none',
         }]
-        self._sort_formats(formats)
         return {
             'id': compat_str(entry.get('ArticleId')),
             'title': entry.get('ArticleTitle'),
@@ -81,7 +77,7 @@ class VoicyIE(VoicyBaseIE):
     }]
 
     def _real_extract(self, url):
-        mobj = re.match(self._VALID_URL, url)
+        mobj = self._match_valid_url(url)
         assert mobj
         voice_id = mobj.group('id')
         channel_id = mobj.group('channel_id')
@@ -108,7 +104,7 @@ class VoicyChannelIE(VoicyBaseIE):
 
     @classmethod
     def suitable(cls, url):
-        return not VoicyIE.suitable(url) and super(VoicyChannelIE, cls).suitable(url)
+        return not VoicyIE.suitable(url) and super().suitable(url)
 
     def _entries(self, channel_id):
         pager = ''