]> jfr.im git - yt-dlp.git/blobdiff - yt_dlp/extractor/beatport.py
[ie/matchtv] Fix extractor (#10190)
[yt-dlp.git] / yt_dlp / extractor / beatport.py
index ae9c1a739909d9eb12796954db2d744b3e3ece87..acc8d125950fee669a1b220c6868c6c42450f30d 100644 (file)
@@ -1,10 +1,6 @@
-# coding: utf-8
-from __future__ import unicode_literals
-
 import re
 
 from .common import InfoExtractor
-from ..compat import compat_str
 from ..utils import int_or_none
 
 
@@ -36,11 +32,11 @@ class BeatportIE(InfoExtractor):
             'display_id': 'birds-original-mix',
             'ext': 'mp4',
             'title': "Tos, Middle Milk, Mumblin' Johnsson - Birds (Original Mix)",
-        }
+        },
     }]
 
     def _real_extract(self, url):
-        mobj = re.match(self._VALID_URL, url)
+        mobj = self._match_valid_url(url)
         track_id = mobj.group('id')
         display_id = mobj.group('display_id')
 
@@ -54,7 +50,7 @@ def _real_extract(self, url):
 
         track = next(t for t in playables['tracks'] if t['id'] == int(track_id))
 
-        title = ', '.join((a['name'] for a in track['artists'])) + ' - ' + track['name']
+        title = ', '.join(a['name'] for a in track['artists']) + ' - ' + track['name']
         if track['mix']:
             title += ' (' + track['mix'] + ')'
 
@@ -77,7 +73,6 @@ def _real_extract(self, url):
                 fmt['abr'] = 96
                 fmt['asr'] = 44100
             formats.append(fmt)
-        self._sort_formats(formats)
 
         images = []
         for name, info in track['images'].items():
@@ -93,7 +88,7 @@ def _real_extract(self, url):
             images.append(image)
 
         return {
-            'id': compat_str(track.get('id')) or track_id,
+            'id': str(track.get('id')) or track_id,
             'display_id': track.get('slug') or display_id,
             'title': title,
             'formats': formats,