mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-11-01 07:00:47 +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:
@@ -1,5 +1,4 @@
|
||||
from .common import InfoExtractor
|
||||
from ..compat import compat_str
|
||||
from ..utils import (
|
||||
determine_ext,
|
||||
format_field,
|
||||
@@ -62,11 +61,11 @@ class VineIE(InfoExtractor):
|
||||
video_id = self._match_id(url)
|
||||
|
||||
data = self._download_json(
|
||||
'https://archive.vine.co/posts/%s.json' % video_id, video_id)
|
||||
f'https://archive.vine.co/posts/{video_id}.json', video_id)
|
||||
|
||||
def video_url(kind):
|
||||
for url_suffix in ('Url', 'URL'):
|
||||
format_url = data.get('video%s%s' % (kind, url_suffix))
|
||||
format_url = data.get(f'video{kind}{url_suffix}')
|
||||
if format_url:
|
||||
return format_url
|
||||
|
||||
@@ -126,14 +125,14 @@ class VineUserIE(InfoExtractor):
|
||||
|
||||
@classmethod
|
||||
def suitable(cls, url):
|
||||
return False if VineIE.suitable(url) else super(VineUserIE, cls).suitable(url)
|
||||
return False if VineIE.suitable(url) else super().suitable(url)
|
||||
|
||||
def _real_extract(self, url):
|
||||
mobj = self._match_valid_url(url)
|
||||
user = mobj.group('user')
|
||||
u = mobj.group('u')
|
||||
|
||||
profile_url = '%sapi/users/profiles/%s%s' % (
|
||||
profile_url = '{}api/users/profiles/{}{}'.format(
|
||||
self._VINE_BASE_URL, 'vanity/' if not u else '', user)
|
||||
profile_data = self._download_json(
|
||||
profile_url, user, note='Downloading user profile data')
|
||||
@@ -141,11 +140,11 @@ class VineUserIE(InfoExtractor):
|
||||
data = profile_data['data']
|
||||
user_id = data.get('userId') or data['userIdStr']
|
||||
profile = self._download_json(
|
||||
'https://archive.vine.co/profiles/%s.json' % user_id, user_id)
|
||||
f'https://archive.vine.co/profiles/{user_id}.json', user_id)
|
||||
entries = [
|
||||
self.url_result(
|
||||
'https://vine.co/v/%s' % post_id, ie='Vine', video_id=post_id)
|
||||
f'https://vine.co/v/{post_id}', ie='Vine', video_id=post_id)
|
||||
for post_id in profile['posts']
|
||||
if post_id and isinstance(post_id, compat_str)]
|
||||
if post_id and isinstance(post_id, str)]
|
||||
return self.playlist_result(
|
||||
entries, user, profile.get('username'), profile.get('description'))
|
||||
|
||||
Reference in New Issue
Block a user