This commit is contained in:
parent
c221e4b352
commit
881db673c7
19
api.py
19
api.py
@ -11,6 +11,25 @@ env = os.environ
|
|||||||
app = FastAPI()
|
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")
|
@app.get("/search_song_by_name")
|
||||||
async def search_song_by_name(
|
async def search_song_by_name(
|
||||||
|
Loading…
Reference in New Issue
Block a user