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(