1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-09-03 00:25:08 +00:00

[cleanup] Add more ruff rules (#10149)

Authored by: seproDev

Reviewed-by: bashonly <88596187+bashonly@users.noreply.github.com>
Reviewed-by: Simon Sawicki <contact@grub4k.xyz>
This commit is contained in:
sepro
2024-06-12 01:09:58 +02:00
committed by GitHub
parent db50f19d76
commit add96eb9f8
915 changed files with 7027 additions and 7246 deletions

View File

@ -24,7 +24,7 @@ from ..utils import (
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 @@ class LBRYBaseIE(InfoExtractor):
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 @@ class LBRYBaseIE(InfoExtractor):
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',