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

@ -70,7 +70,7 @@ class DPlayBaseIE(InfoExtractor):
self._initialize_geo_bypass({
'countries': geo_countries,
})
disco_base = 'https://%s/' % disco_host
disco_base = f'https://{disco_host}/'
headers = {
'Referer': url,
}
@ -84,7 +84,7 @@ class DPlayBaseIE(InfoExtractor):
'fields[show]': 'name',
'fields[tag]': 'name',
'fields[video]': 'description,episodeNumber,name,publishStart,seasonNumber,videoDuration',
'include': 'images,primaryChannel,show,tags'
'include': 'images,primaryChannel,show,tags',
})
except ExtractorError as e:
if isinstance(e.cause, HTTPError) and e.cause.status == 400:
@ -359,7 +359,7 @@ class DiscoveryPlusBaseIE(DPlayBaseIE):
},
'videoId': video_id,
'wisteriaProperties': {},
}).encode('utf-8'))['data']['attributes']['streaming']
}).encode())['data']['attributes']['streaming']
def _real_extract(self, url):
return self._get_disco_api_info(url, self._match_id(url), **self._DISCO_API_PARAMS)
@ -857,7 +857,7 @@ class DiscoveryPlusIndiaIE(DiscoveryPlusBaseIE):
},
'params': {
'skip_download': True,
}
},
}]
_PRODUCT = 'dplus-india'
@ -870,7 +870,7 @@ class DiscoveryPlusIndiaIE(DiscoveryPlusBaseIE):
def _update_disco_api_headers(self, headers, disco_base, display_id, realm):
headers.update({
'x-disco-params': 'realm=%s' % realm,
'x-disco-params': f'realm={realm}',
'x-disco-client': f'WEB:UNKNOWN:{self._PRODUCT}:17.0.0',
'Authorization': self._get_auth(disco_base, display_id, realm),
})
@ -967,14 +967,14 @@ class DiscoveryPlusShowBaseIE(DPlayBaseIE):
while page_num < total_pages:
season_json = self._download_json(
season_url.format(season_id, show_id, str(page_num + 1)), show_name, headers=headers,
note='Downloading season %s JSON metadata%s' % (season_id, ' page %d' % page_num if page_num else ''))
note='Downloading season {} JSON metadata{}'.format(season_id, f' page {page_num}' if page_num else ''))
if page_num == 0:
total_pages = try_get(season_json, lambda x: x['meta']['totalPages'], int) or 1
episodes_json = season_json['data']
for episode in episodes_json:
video_path = episode['attributes']['path']
yield self.url_result(
'%svideos/%s' % (self._DOMAIN, video_path),
f'{self._DOMAIN}videos/{video_path}',
ie=self._VIDEO_IE.ie_key(), video_id=episode.get('id') or video_path)
page_num += 1
@ -1002,7 +1002,7 @@ class DiscoveryPlusItalyIE(DiscoveryPlusBaseIE):
def _update_disco_api_headers(self, headers, disco_base, display_id, realm):
headers.update({
'x-disco-params': 'realm=%s' % realm,
'x-disco-params': f'realm={realm}',
'x-disco-client': f'WEB:UNKNOWN:{self._PRODUCT}:25.2.6',
'Authorization': self._get_auth(disco_base, display_id, realm),
})