]> jfr.im git - yt-dlp.git/blobdiff - yt_dlp/extractor/udn.py
[cleanup] Add more ruff rules (#10149)
[yt-dlp.git] / yt_dlp / extractor / udn.py
index 9fdb46faf6c9b4bb88896cb8896cbae254141df1..9970e4ff5040afb2a6e66c1e7bc9076902eefb09 100644 (file)
@@ -1,4 +1,5 @@
 import re
+import urllib.parse
 
 from .common import InfoExtractor
 from ..utils import (
@@ -6,14 +7,13 @@
     int_or_none,
     js_to_json,
 )
-from ..compat import compat_urlparse
 
 
 class UDNEmbedIE(InfoExtractor):
     IE_DESC = '聯合影音'
     _PROTOCOL_RELATIVE_VALID_URL = r'//video\.udn\.com/(?:embed|play)/news/(?P<id>\d+)'
     _VALID_URL = r'https?:' + _PROTOCOL_RELATIVE_VALID_URL
-    _EMBED_REGEX = [r'<iframe[^>]+src="(?:https?:)?(?P<url>%s)"' % _PROTOCOL_RELATIVE_VALID_URL]
+    _EMBED_REGEX = [rf'<iframe[^>]+src="(?:https?:)?(?P<url>{_PROTOCOL_RELATIVE_VALID_URL})"']
     _TESTS = [{
         'url': 'http://video.udn.com/embed/news/300040',
         'info_dict': {
@@ -66,8 +66,8 @@ def _real_extract(self, url):
                 continue
 
             video_url = self._download_webpage(
-                compat_urlparse.urljoin(url, api_url), video_id,
-                note='retrieve url for %s video' % video_type)
+                urllib.parse.urljoin(url, api_url), video_id,
+                note=f'retrieve url for {video_type} video')
 
             ext = determine_ext(video_url)
             if ext == 'm3u8':
@@ -90,8 +90,6 @@ def _real_extract(self, url):
                     })
                 formats.append(a_format)
 
-        self._sort_formats(formats)
-
         return {
             'id': video_id,
             'formats': formats,