|
|
|
@ -10,7 +10,7 @@ headers = { # 设置请求头
|
|
|
|
|
"User-agent":
|
|
|
|
|
"Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.71 Safari/537.36 Core/1.94.169.400 QQBrowser/11.0.5130.400",
|
|
|
|
|
"Cookie":
|
|
|
|
|
"kg_mid=14e57fa8f8bd5163efe72e9847a80e64; kg_dfid=0jICDR1Z9i6c3Xwh3n02F2uD; KuGooRandom=66751668051014213; kg_dfid_collect=d41d8cd98f00b204e9800998ecf8427e; ACK_SERVER_10015=%7B%22list%22%3A%5B%5B%22bjlogin-user.kugou.com%22%5D%5D%7D; Hm_lvt_aedee6983d4cfc62f509129360d6bb3d=1668330462,1669556862,1669856911,1669877618; Hm_lpvt_aedee6983d4cfc62f509129360d6bb3d=1669878413; ACK_SERVER_10016=%7B%22list%22%3A%5B%5B%22bjreg-user.kugou.com%22%5D%5D%7D; ACK_SERVER_10017=%7B%22list%22%3A%5B%5B%22bjverifycode.service.kugou.com%22%5D%5D%7D",
|
|
|
|
|
"kg_mid=14e57fa8f8bd5163efe72e9847a80e64; kg_dfid=0jICDR1Z9i6c3Xwh3n02F2uD; kg_dfid_collect=d41d8cd98f00b204e9800998ecf8427e; Hm_lvt_aedee6983d4cfc62f509129360d6bb3d=1669556862,1669856911,1669877618,1669889562; kg_mid_temp=14e57fa8f8bd5163efe72e9847a80e64; KuGoo=KugooID=650152187&KugooPwd=3C564C11588FE543C170C1DE2FE12CBE&NickName=%u0035%u0035%u0035%u0035%u0034%u0034&Pic=http://imge.kugou.com/kugouicon/165/20100101/20100101192931478054.jpg&RegState=1&RegFrom=&t=8ea6a545bf550f5845a622cab06619f65cf61eb2ad5f17b725c792751ad4732d&t_ts=1669893548&t_key=&a_id=1014&ct=1669893548&UserName=%u006b%u0067%u006f%u0070%u0065%u006e%u0036%u0035%u0030%u0031%u0035%u0032%u0031%u0038%u0037; KugooID=650152187; t=8ea6a545bf550f5845a622cab06619f65cf61eb2ad5f17b725c792751ad4732d; a_id=1014; UserName=%u006b%u0067%u006f%u0070%u0065%u006e%u0036%u0035%u0030%u0031%u0035%u0032%u0031%u0038%u0037; mid=14e57fa8f8bd5163efe72e9847a80e64; dfid=0jICDR1Z9i6c3Xwh3n02F2uD; Hm_lpvt_aedee6983d4cfc62f509129360d6bb3d=1669893568",
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -72,14 +72,23 @@ def the_Any_music():
|
|
|
|
|
list_num =1
|
|
|
|
|
print(f"页数总数为{list_num}")
|
|
|
|
|
num = input("输入你想查看得页数:")
|
|
|
|
|
list_url = "http://mobilecdn.kugou.com/api/v3/search/song?format=json&keyword=" + song_name + "&page=" + str(num)
|
|
|
|
|
list_req = requests.get(url=list_url, headers=headers)
|
|
|
|
|
list_json = json.loads(list_req.text[n:])
|
|
|
|
|
y = 1
|
|
|
|
|
for x in list_json['data']['info']:
|
|
|
|
|
print(f"{y}.{x.get('songname')} {x.get('singername')}")
|
|
|
|
|
y = y + 1
|
|
|
|
|
song_num = input("输入你想获取第几首歌曲:")
|
|
|
|
|
#song_num = ''
|
|
|
|
|
while True:
|
|
|
|
|
list_url = "http://mobilecdn.kugou.com/api/v3/search/song?format=json&keyword=" + song_name + "&page=" + str(num)
|
|
|
|
|
list_req = requests.get(url=list_url, headers=headers)
|
|
|
|
|
list_json = json.loads(list_req.text[n:])
|
|
|
|
|
y = 1
|
|
|
|
|
for x in list_json['data']['info']:
|
|
|
|
|
print(f"{y}.{x.get('songname')} {x.get('singername')}")
|
|
|
|
|
y = y + 1
|
|
|
|
|
song_num = input("输入你想获取第几首歌曲(或者输入next查看下一页):")
|
|
|
|
|
if song_num == 'next':
|
|
|
|
|
num = str(int(num) + 1)
|
|
|
|
|
if int(num) >list_num:
|
|
|
|
|
print('已经到达最后1页')
|
|
|
|
|
num = str(list_num)
|
|
|
|
|
else:
|
|
|
|
|
break
|
|
|
|
|
print("开始爬取内容")
|
|
|
|
|
print("请稍等一会")
|
|
|
|
|
y = 1
|
|
|
|
@ -105,6 +114,7 @@ def the_Any_music():
|
|
|
|
|
print("爬取完成")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
menubar = ["功能榜单", "1.爬取酷狗热门榜", "2.爬取任意音乐", "3.退出系统"]
|
|
|
|
|
for x in menubar:
|
|
|
|
|
print(x)
|
|
|
|
|