]> jfr.im git - yt-dlp.git/blobdiff - yt_dlp/extractor/flickr.py
[cleanup] Add more ruff rules (#10149)
[yt-dlp.git] / yt_dlp / extractor / flickr.py
index 89a40d7e23a6ff360a94baa62c9769be3311d6be..507bfe9d4150d1a2ebba5b8b4a6dc02469b81fca 100644 (file)
@@ -1,8 +1,6 @@
+import urllib.parse
+
 from .common import InfoExtractor
-from ..compat import (
-    compat_str,
-    compat_urllib_parse_urlencode,
-)
 from ..utils import (
     ExtractorError,
     format_field,
@@ -31,7 +29,7 @@ class FlickrIE(InfoExtractor):
             'view_count': int,
             'tags': list,
             'license': 'Attribution-ShareAlike',
-        }
+        },
     }
     _API_BASE_URL = 'https://api.flickr.com/services/rest?'
     # https://help.yahoo.com/kb/flickr/SLN25525.html
@@ -52,14 +50,14 @@ class FlickrIE(InfoExtractor):
     def _call_api(self, method, video_id, api_key, note, secret=None):
         query = {
             'photo_id': video_id,
-            'method': 'flickr.%s' % method,
+            'method': f'flickr.{method}',
             'api_key': api_key,
             'format': 'json',
             'nojsoncallback': 1,
         }
         if secret:
             query['secret'] = secret
-        data = self._download_json(self._API_BASE_URL + compat_urllib_parse_urlencode(query), video_id, note)
+        data = self._download_json(self._API_BASE_URL + urllib.parse.urlencode(query), video_id, note)
         if data['stat'] != 'ok':
             raise ExtractorError(data['message'])
         return data
@@ -83,7 +81,7 @@ def _real_extract(self, url):
 
             formats = []
             for stream in streams['stream']:
-                stream_type = compat_str(stream.get('type'))
+                stream_type = str(stream.get('type'))
                 formats.append({
                     'format_id': stream_type,
                     'url': stream['_content'],