From 881db673c7a6268dd4e603c12e681e504d37ef23 Mon Sep 17 00:00:00 2001 From: 1264204425 <1264204425@qq.com> Date: Sun, 30 Jul 2023 21:03:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=A6=9C=E5=8D=95api?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/api.py b/api.py index 6baa07e..d611b8d 100644 --- a/api.py +++ b/api.py @@ -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(