mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2026-02-20 15:35:44 +00:00
[RadioFrance] Fix ruff issues
This commit is contained in:
@@ -259,7 +259,7 @@ class RadioFrancePlaylistBaseIE(RadioFranceBaseIE):
|
|||||||
raise NotImplementedError('This method must be implemented by subclasses')
|
raise NotImplementedError('This method must be implemented by subclasses')
|
||||||
|
|
||||||
def _generate_playlist_entries(self, station, content_id, content_response):
|
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']:
|
for entry in content_response['items']:
|
||||||
yield self.url_result(
|
yield self.url_result(
|
||||||
f'https://www.radiofrance.fr{entry["link"]}', url_transparent=True, **traverse_obj(entry, {
|
f'https://www.radiofrance.fr{entry["link"]}', url_transparent=True, **traverse_obj(entry, {
|
||||||
@@ -269,11 +269,11 @@ class RadioFrancePlaylistBaseIE(RadioFranceBaseIE):
|
|||||||
'thumbnail': ('visual', 'src'),
|
'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
|
break
|
||||||
|
|
||||||
content_response = self._call_api(station, content_id, content_response['next'])
|
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
playlist_id = self._match_id(url)
|
playlist_id = self._match_id(url)
|
||||||
# If it is a podcast playlist, get the name of the station it is on
|
# If it is a podcast playlist, get the name of the station it is on
|
||||||
@@ -358,7 +358,7 @@ class RadioFrancePodcastIE(RadioFrancePlaylistBaseIE):
|
|||||||
url = 'https://www.radiofrance.fr/' + station + '/podcasts/' + podcast_id + '?p=' + str(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}')
|
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
|
# _search_json cannot parse the data as it contains javascript
|
||||||
# Therefore, parse the episodes objects array separately
|
# Therefore, parse the episodes objects array separately
|
||||||
@@ -409,7 +409,7 @@ class RadioFranceProfileIE(RadioFrancePlaylistBaseIE):
|
|||||||
url = 'https://www.radiofrance.fr/personnes/' + profile_id + '?p=' + str(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}')
|
webpage = self._download_webpage(url, profile_id, note=f'Downloading {profile_id} page {cursor}')
|
||||||
|
|
||||||
resp = dict()
|
resp = {}
|
||||||
resp['items'] = []
|
resp['items'] = []
|
||||||
|
|
||||||
# get episode data from page
|
# get episode data from page
|
||||||
@@ -432,7 +432,7 @@ class RadioFranceProfileIE(RadioFrancePlaylistBaseIE):
|
|||||||
transform_source=js_to_json)
|
transform_source=js_to_json)
|
||||||
# If the image data is stored separately rather than in the main content area
|
# If the image data is stored separately rather than in the main content area
|
||||||
if resp['metadata']['visual'] and isinstance(resp['metadata']['visual'], str):
|
if resp['metadata']['visual'] and isinstance(resp['metadata']['visual'], str):
|
||||||
imagedata = dict()
|
imagedata = {}
|
||||||
imagedata['src'] = self._og_search_thumbnail(webpage)
|
imagedata['src'] = self._og_search_thumbnail(webpage)
|
||||||
resp['metadata']['visual'] = imagedata
|
resp['metadata']['visual'] = imagedata
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user