新增榜单api
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
1264204425 2023-07-30 21:03:11 +08:00
parent c221e4b352
commit 881db673c7

19
api.py
View File

@ -11,6 +11,25 @@ env = os.environ
app = FastAPI()
# 榜单获取
@app.get("/get_rank")
async def get_rank(
rank_id: str = fastapi.Query(..., description="榜单类型")):
"""
:param rank_id:
19723756 云音乐飙升榜
3779629 云音乐新歌榜
3778678 云音乐热歌榜
2884035 云音乐原创榜
:return:
"""
url = f"https://music.163.com/api/playlist/detail?id={rank_id}"
response = requests.get(url)
data = response.json()
return {"message": "success", "data": data}
# 根据歌曲名称搜索歌曲
@app.get("/search_song_by_name")
async def search_song_by_name(