1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-07-18 11:18:30 +00:00

[ie/locipo] Clean up _download_json block

This commit is contained in:
gravesducking 2025-07-09 23:22:43 +09:00
parent 1925bb95b7
commit 15b1211c21

View File

@ -61,15 +61,13 @@ def _real_extract(self, url: str):
if not playlist_id:
creative_data = self._download_json(
url_or_request=f'https://api.locipo.jp/api/v1/creatives/{creative_id}',
video_id=creative_id,
headers=filter_dict(
{
'accept': 'application/json, text/plain, */*',
'origin': 'https://locipo.jp',
'referer': 'https://locipo.jp/',
},
),
f'https://api.locipo.jp/api/v1/creatives/{creative_id}',
creative_id,
headers={
'accept': 'application/json, text/plain, */*',
'origin': 'https://locipo.jp',
'referer': 'https://locipo.jp/',
},
)
return {
@ -93,28 +91,24 @@ def _real_extract(self, url: str):
}
playlist_data = self._download_json(
url_or_request=f'https://api.locipo.jp/api/v1/playlists/{playlist_id}',
video_id=playlist_id,
headers=filter_dict(
{
'accept': 'application/json, text/plain, */*',
'origin': 'https://locipo.jp',
'referer': 'https://locipo.jp/',
},
),
f'https://api.locipo.jp/api/v1/playlists/{playlist_id}',
playlist_id,
headers={
'accept': 'application/json, text/plain, */*',
'origin': 'https://locipo.jp',
'referer': 'https://locipo.jp/',
},
)
# NOTE: This API can return up to 1000 videos. Since there doesn't seem to be any playlist with more than 1000 items at the moment, pagination is currently not implemented.
playlist_creatives_data = self._download_json(
url_or_request=f'https://api.locipo.jp/api/v1/playlists/{playlist_id}/creatives',
video_id=None,
headers=filter_dict(
{
'accept': 'application/json, text/plain, */*',
'origin': 'https://locipo.jp',
'referer': 'https://locipo.jp/',
},
),
f'https://api.locipo.jp/api/v1/playlists/{playlist_id}/creatives',
None,
headers={
'accept': 'application/json, text/plain, */*',
'origin': 'https://locipo.jp',
'referer': 'https://locipo.jp/',
},
)
entries = []