From 5c68ee17d7e69d734e0ad9cec691ec725332dee8 Mon Sep 17 00:00:00 2001 From: WKJYES Date: Sun, 13 Nov 2022 15:18:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=91=E4=BB=AC=E7=9A=84=E7=AC=AC=E4=B8=80?= =?UTF-8?q?=E6=AC=A1push?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/.gitignore | 3 + .idea/Spider.iml | 10 +++ .idea/inspectionProfiles/Project_Default.xml | 12 ++++ .../inspectionProfiles/profiles_settings.xml | 6 ++ .idea/misc.xml | 4 ++ .idea/modules.xml | 8 +++ main.py | 67 +++++++++++++++++++ 7 files changed, 110 insertions(+) create mode 100644 .idea/.gitignore create mode 100644 .idea/Spider.iml create mode 100644 .idea/inspectionProfiles/Project_Default.xml create mode 100644 .idea/inspectionProfiles/profiles_settings.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 main.py diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/Spider.iml b/.idea/Spider.iml new file mode 100644 index 0000000..74d515a --- /dev/null +++ b/.idea/Spider.iml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..d62ab05 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,12 @@ + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..da7d34f --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..61c2e8d --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/main.py b/main.py new file mode 100644 index 0000000..903e46d --- /dev/null +++ b/main.py @@ -0,0 +1,67 @@ +import json +import requests + +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; Hm_lvt_aedee6983d4cfc62f509129360d6bb3d=1668051000,1668243927; kg_dfid_collect=d41d8cd98f00b204e9800998ecf8427e; kg_mid_temp=14e57fa8f8bd5163efe72e9847a80e64; Hm_lpvt_aedee6983d4cfc62f509129360d6bb3d=1668245258", +} +list_url ='https://complexsearch.kugou.com/v2/search/song?callback=callback123&srcappid=2919&clientver=1000&clienttime=1668257140471&mid=14e57fa8f8bd5163efe72e9847a80e64&uuid=14e57fa8f8bd5163efe72e9847a80e64&dfid=0jICDR1Z9i6c3Xwh3n02F2uD&keyword=%E5%8F%AA%E5%9B%A0%E4%BD%A0%E5%A4%AA%E7%BE%8E&page=1&pagesize=30&bitrate=0&isfuzzy=0&inputtype=0&platform=WebFilter&userid=0&iscorrection=1&privilege_filter=0&filter=10&token=&appid=1014&signature=5d256cf87e57f93badbdceaad2e1eb33' +req_list = requests.get(url=list_url,headers=headers) +char='{' +n =req_list.text.find(char) +list_json = json.loads(req_list.text[n:-2]) +url ='https://wwwapi.kugou.com/yy/index.php?r=play/getdata&hash=' +for i in list_json['data']['lists']: + url1 = url +i.get('FileHash')+"&album_id="+str(i.get('AlbumID')) + req = requests.get(url=url1,headers=headers) + req_json = json.loads(req.text) + song_url = req_json['data'].get('play_url') + print(song_url) + req1 = requests.get(url=song_url) + with open(f'{req_json["data"].get("audio_name")}.mp3','wb') as f: + f.write(req1.content) + f.close() + req1.close() + req.close() +req_list.close() + +# url1 = url +list_json['data']['lists'][0].get('FileHash')+"&album_id="+str(list_json['data']['lists'][0].get('AlbumID')) +# req = requests.get(url=url1,headers=headers) +# req_json = json.loads(req.text) +# song_url = req_json['data'].get('play_url') +# req1 = requests.get(url=song_url) +# with open(f'{req_json["data"].get("audio_name")}.mp3','wb') as f: +# f.write(req1.content) +#https://wwwapi.kugou.com/yy/index.php?r=play/getdata&callback=jQuery19107826705776976817_1668256148578&hash=D80A9FB3362FB91C2D06D70E321F4BC5&dfid=0jICDR1Z9i6c3Xwh3n02F2uD&appid=1014&mid=14e57fa8f8bd5163efe72e9847a80e64&platid=4&album_id=1944022&_=1668256148598 +#https://www.kugou.com/mixsong/vjjt936.html?fromsearch=只因你太美#hash=D80A9FB3362FB91C2D06D70E321F4BC5&album_id=1944022&album_audio_id=52980237 +#https://wwwapi.kugou.com/yy/index.php?r=play/getdata&callback=jQuery191038106222049194827_1668261761236&hash=D80A9FB3362FB91C2D06D70E321F4BC5&dfid=0jICDR1Z9i6c3Xwh3n02F2uD&appid=1014&mid=14e57fa8f8bd5163efe72e9847a80e64&platid=4&album_id=1944022&_=1668261761246 +# url = 'https://wwwapi.kugou.com/yy/index.php?r=play/getdata&hash=' +# for i in songlist: +# print(url+i.get("FileHash")) + # req = requests.get(url=url) + # with open(f'{i.get("SongName")}.mp3','wb') as f: +# # # f.write(req.content) +# url='https://voice.baidu.com/api/newpneumonia?from=page&callback=jsonp_1668237727742_73497' +# 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' +# } +# req = requests.get(url=url,headers=headers) +# reqjson = json.loads(req.text[26:-2]) +# with open('疫情.csv','w',encoding='UTF-8') as f: +# f.write(f'{"省市地区"}, {"新增确诊"}, {"新增无症状"}, {"累计确诊"}, {"风险地区"}\n') +# # for i in reqjson['data']['resumes']['chinaProvince']: +# # for j in reqjson['data']['resumes']['chinaProvince'][f'{i}']['list']: +# # f.write(f'{j.get("area")},{j.get("asymptomaticLocalRelative")},{j.get("asymptomaticRelative")},{j.get("confirmed")}\n') +# for i in reqjson['data']['resumes']['china']['list']: +# f.write(f'{i.get("province")},{i.get("nativeRelative")},{i.get("asymptomaticLocalRelative")},{i.get("confirmed")},{i.get("asymptomaticRelative")}\n') + +# #导入csv文件模块: +# import csv # 该模块为内置模块不用安装! +# list3 = [["姓名","爱好","年龄","性别"],["特斯拉",'喜欢核辐射','未知','雄性'],["迪迦",'打怪兽','未知','雄性'] ] +# +# for i in list3: +# print(i) +# fp =open('adi.csv',mode='a+',newline='') # ps:此处记得用“a+” 不然首行会变成空行! +# dp = csv.writer(fp) +# dp.writerow(i) +# fp.close()