[RadioFrance] Fix ruff issues

This commit is contained in:
lonm 2024-10-15 15:04:48 +01:00
parent 3c5e3af7bc
commit 0fb8bc11ed

View File

@ -259,7 +259,7 @@ def _call_api(self, station, content_id, cursor):
raise NotImplementedError('This method must be implemented by subclasses')
def _generate_playlist_entries(self, station, content_id, content_response):
for page_num in itertools.count(2):
while True:
for entry in content_response['items']:
yield self.url_result(
f'https://www.radiofrance.fr{entry["link"]}', url_transparent=True, **traverse_obj(entry, {
@ -269,11 +269,11 @@ def _generate_playlist_entries(self, station, content_id, content_response):
'thumbnail': ('visual', 'src'),
}))
if not content_response['next']:
if content_response['next']:
content_response = self._call_api(station, content_id, content_response['next'])
else:
break
content_response = self._call_api(station, content_id, content_response['next'])
def _real_extract(self, url):
playlist_id = self._match_id(url)
# If it is a podcast playlist, get the name of the station it is on
@ -358,7 +358,7 @@ def _call_api(self, station, podcast_id, cursor):
url = 'https://www.radiofrance.fr/' + station + '/podcasts/' + podcast_id + '?p=' + str(cursor)
webpage = self._download_webpage(url, podcast_id, note=f'Downloading {podcast_id} page {cursor}')
resp = dict()
resp = {}
# _search_json cannot parse the data as it contains javascript
# Therefore, parse the episodes objects array separately
@ -409,7 +409,7 @@ def _call_api(self, station, profile_id, cursor):
url = 'https://www.radiofrance.fr/personnes/' + profile_id + '?p=' + str(cursor)
webpage = self._download_webpage(url, profile_id, note=f'Downloading {profile_id} page {cursor}')
resp = dict()
resp = {}
resp['items'] = []
# get episode data from page
@ -432,7 +432,7 @@ def _call_api(self, station, profile_id, cursor):
transform_source=js_to_json)
# If the image data is stored separately rather than in the main content area
if resp['metadata']['visual'] and isinstance(resp['metadata']['visual'], str):
imagedata = dict()
imagedata = {}
imagedata['src'] = self._og_search_thumbnail(webpage)
resp['metadata']['visual'] = imagedata