feat(beatmapset): use https://catboy.best as global downloading service
This commit is contained in:
@@ -231,7 +231,7 @@ async def download_beatmapset(
|
|||||||
f"https://dl.sayobot.cn/beatmaps/download/{'novideo' if no_video else 'full'}/{beatmapset_id}"
|
f"https://dl.sayobot.cn/beatmaps/download/{'novideo' if no_video else 'full'}/{beatmapset_id}"
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
return RedirectResponse(f"https://api.nerinyan.moe/d/{beatmapset_id}?noVideo={no_video}")
|
return RedirectResponse(f"https://catboy.best/d/{beatmapset_id}{'n' if no_video else ''}")
|
||||||
|
|
||||||
|
|
||||||
@router.post(
|
@router.post(
|
||||||
|
|||||||
@@ -54,22 +54,31 @@ class BeatmapDownloadService:
|
|||||||
|
|
||||||
# 国外区域端点
|
# 国外区域端点
|
||||||
self.international_endpoints = [
|
self.international_endpoints = [
|
||||||
|
DownloadEndpoint(
|
||||||
|
name="Catboy",
|
||||||
|
base_url="https://catboy.best",
|
||||||
|
health_check_url="https://catboy.best/api",
|
||||||
|
url_template="https://catboy.best/d/{sid}",
|
||||||
|
is_china=False,
|
||||||
|
priority=0,
|
||||||
|
timeout=10,
|
||||||
|
),
|
||||||
DownloadEndpoint(
|
DownloadEndpoint(
|
||||||
name="Nerinyan",
|
name="Nerinyan",
|
||||||
base_url="https://api.nerinyan.moe",
|
base_url="https://api.nerinyan.moe",
|
||||||
health_check_url="https://api.nerinyan.moe/health",
|
health_check_url="https://api.nerinyan.moe/health",
|
||||||
url_template="https://api.nerinyan.moe/d/{sid}?noVideo={no_video}",
|
url_template="https://api.nerinyan.moe/d/{sid}?noVideo={no_video}",
|
||||||
is_china=False,
|
is_china=False,
|
||||||
priority=0,
|
priority=1,
|
||||||
timeout=10,
|
timeout=10,
|
||||||
),
|
),
|
||||||
DownloadEndpoint(
|
DownloadEndpoint(
|
||||||
name="OsuDirect",
|
name="OsuDirect",
|
||||||
base_url="https://osu.direct",
|
base_url="https://osu.direct",
|
||||||
health_check_url="https://osu.direct/api/status",
|
health_check_url="https://osu.direct/api/status",
|
||||||
url_template="https://osu.direct/api/d/{sid}",
|
url_template="https://osu.direct/api/d/{sid}?noVideo={no_video}",
|
||||||
is_china=False,
|
is_china=False,
|
||||||
priority=1,
|
priority=2,
|
||||||
timeout=10,
|
timeout=10,
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
@@ -211,11 +220,10 @@ class BeatmapDownloadService:
|
|||||||
if endpoint.name == "Sayobot":
|
if endpoint.name == "Sayobot":
|
||||||
video_type = "novideo" if no_video else "full"
|
video_type = "novideo" if no_video else "full"
|
||||||
return endpoint.url_template.format(type=video_type, sid=beatmapset_id)
|
return endpoint.url_template.format(type=video_type, sid=beatmapset_id)
|
||||||
elif endpoint.name == "Nerinyan":
|
elif endpoint.name == "Nerinyan" or endpoint.name == "OsuDirect":
|
||||||
return endpoint.url_template.format(sid=beatmapset_id, no_video="true" if no_video else "false")
|
return endpoint.url_template.format(sid=beatmapset_id, no_video="true" if no_video else "false")
|
||||||
elif endpoint.name == "OsuDirect":
|
elif endpoint.name == "Catboy":
|
||||||
# osu.direct 似乎没有no_video参数,直接使用基础URL
|
return endpoint.url_template.format(sid=f"{beatmapset_id}n" if no_video else beatmapset_id)
|
||||||
return endpoint.url_template.format(sid=beatmapset_id)
|
|
||||||
else:
|
else:
|
||||||
# 默认处理
|
# 默认处理
|
||||||
return endpoint.url_template.format(sid=beatmapset_id)
|
return endpoint.url_template.format(sid=beatmapset_id)
|
||||||
|
|||||||
Reference in New Issue
Block a user