]> jfr.im git - yt-dlp.git/blobdiff - yt_dlp/extractor/lbry.py
[cleanup] Add more ruff rules (#10149)
[yt-dlp.git] / yt_dlp / extractor / lbry.py
index dcb44d07f93d32df0e783ffaa2308d1a7931a030..c764d49611df7917739304aa4bbc854f8d891766 100644 (file)
@@ -24,7 +24,7 @@
 class LBRYBaseIE(InfoExtractor):
     _BASE_URL_REGEX = r'(?x)(?:https?://(?:www\.)?(?:lbry\.tv|odysee\.com)/|lbry://)'
     _CLAIM_ID_REGEX = r'[0-9a-f]{1,40}'
-    _OPT_CLAIM_ID = '[^$@:/?#&]+(?:[:#]%s)?' % _CLAIM_ID_REGEX
+    _OPT_CLAIM_ID = f'[^$@:/?#&]+(?:[:#]{_CLAIM_ID_REGEX})?'
     _SUPPORTED_STREAM_TYPES = ['video', 'audio']
     _PAGE_SIZE = 50
 
@@ -35,7 +35,7 @@ def _call_api_proxy(self, method, display_id, params, resource):
             headers['x-lbry-auth-token'] = token
         response = self._download_json(
             'https://api.lbry.tv/api/v1/proxy',
-            display_id, 'Downloading %s JSON metadata' % resource,
+            display_id, f'Downloading {resource} JSON metadata',
             headers=headers,
             data=json.dumps({
                 'method': method,
@@ -54,7 +54,7 @@ def _resolve_url(self, url, display_id, resource):
     def _permanent_url(self, url, claim_name, claim_id):
         return urljoin(
             url.replace('lbry://', 'https://lbry.tv/'),
-            '/%s:%s' % (claim_name, claim_id))
+            f'/{claim_name}:{claim_id}')
 
     def _parse_stream(self, stream, url):
         stream_type = traverse_obj(stream, ('value', 'stream_type', {str}))
@@ -169,9 +169,9 @@ class LBRYIE(LBRYBaseIE):
                 'lbc',
                 'lbry',
                 'start',
-                'tutorial'
+                'tutorial',
             ],
-        }
+        },
     }, {
         # Audio
         'url': 'https://lbry.tv/@LBRYFoundation:0/Episode-1:e',
@@ -194,7 +194,7 @@ class LBRYIE(LBRYBaseIE):
             'thumbnail': 'https://spee.ch/d/0bc63b0e6bf1492d.png',
             'license': 'None',
             'uploader_id': '@LBRYFoundation',
-        }
+        },
     }, {
         'url': 'https://odysee.com/@gardeningincanada:b/plants-i-will-never-grow-again.-the:e',
         'md5': 'c35fac796f62a14274b4dc2addb5d0ba',
@@ -216,7 +216,7 @@ class LBRYIE(LBRYBaseIE):
             'formats': 'mincount:3',
             'thumbnail': 'https://thumbnails.lbry.com/AgHSc_HzrrE',
             'license': 'Copyrighted (contact publisher)',
-        }
+        },
     }, {
         # HLS live stream (might expire)
         'url': 'https://odysee.com/@RT:fd/livestream_RT:d',
@@ -239,7 +239,7 @@ class LBRYIE(LBRYBaseIE):
             'license': 'None',
             'uploader_id': '@RT',
         },
-        'params': {'skip_download': True}
+        'params': {'skip_download': True},
     }, {
         # original quality format w/higher resolution than HLS formats
         'url': 'https://odysee.com/@wickedtruths:2/Biotechnological-Invasion-of-Skin-(April-2023):4',