py格式转换软件

此软件用于配合 爬虫工具库的(https://spidertools.cn/#/curl2Request) curl转request 功能使用,可以让代码转换为面向对象格式的代码

点击下载

https://yybf1.cn/wp-content/uploads/2025/05/Py文件转换工具.zip

软件页面展示

spaced title

爬虫工具库转换的代码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import requests


headers = {
"Accept": "application/json, text/plain, */*",
"Accept-Language": "zh-CN,zh;q=0.9",
"Cache-Control": "no-cache",
"Connection": "keep-alive",
"Pragma": "no-cache",
"Referer": "https://www.kuwo.cn/search/list?key=%E5%B1%B1%E6%A5%82%E6%A0%91%E4%B9%8B%E6%81%8B",
"Sec-Fetch-Dest": "empty",
"Sec-Fetch-Mode": "cors",
"Sec-Fetch-Site": "same-origin",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36",
"sec-ch-ua": "\"Google Chrome\";v=\"135\", \"Not-A.Brand\";v=\"8\", \"Chromium\";v=\"135\"",
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-platform": "\"Windows\""
}
cookies = {
"_ga": "GA1.2.1461956199.1739775301",
"_ga_ETPBRPM9ML": "GS1.2.1740390750.10.1.1740390760.50.0.0",
"_gid": "GA1.2.1793827809.1746524913",
"_gat": "1",
"Hm_lvt_cdb524f42f0ce19b169a8071123a4797": "1746524913",
"Hm_lpvt_cdb524f42f0ce19b169a8071123a4797": "1746524913",
"HMACCOUNT": "0918E9374F8EFB4E",
"Hm_Iuvt_cdb524f42f23cer9b268564v7y735ewrq2324": "EPkJXzJkPcTFhkaEH83Qcxkm5FbpS5ZS"
}
url = "https://www.kuwo.cn/search/searchMusicBykeyWord"
params = {
"vipver": "1",
"client": "kt",
"ft": "music",
"cluster": "0",
"strategy": "2012",
"encoding": "utf8",
"rformat": "json",
"mobi": "1",
"issubtitle": "1",
"show_copyright_off": "1",
"pn": "0",
"rn": "20",
"all": "山楂树之恋"
}
response = requests.get(url, headers=headers, cookies=cookies, params=params)

print(response.text)
print(response)

py格式转换软件 转换后

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import requests


class SearchmusicbykeywordApi:
def __init__(self):
pass

def get_searchmusicbykeyword(self):
headers = {
"Accept": "application/json, text/plain, */*",
"Accept-Language": "zh-CN,zh;q=0.9",
"Cache-Control": "no-cache",
"Connection": "keep-alive",
"Pragma": "no-cache",
"Referer": "https://www.kuwo.cn/search/list?key=%E5%B1%B1%E6%A5%82%E6%A0%91%E4%B9%8B%E6%81%8B",
"Sec-Fetch-Dest": "empty",
"Sec-Fetch-Mode": "cors",
"Sec-Fetch-Site": "same-origin",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36",
"sec-ch-ua": "\"Google Chrome\";v=\"135\", \"Not-A.Brand\";v=\"8\", \"Chromium\";v=\"135\"",
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-platform": "\"Windows\""
}
cookies = {
"_ga": "GA1.2.1461956199.1739775301",
"_ga_ETPBRPM9ML": "GS1.2.1740390750.10.1.1740390760.50.0.0",
"_gid": "GA1.2.1793827809.1746524913",
"_gat": "1",
"Hm_lvt_cdb524f42f0ce19b169a8071123a4797": "1746524913",
"Hm_lpvt_cdb524f42f0ce19b169a8071123a4797": "1746524913",
"HMACCOUNT": "0918E9374F8EFB4E",
"Hm_Iuvt_cdb524f42f23cer9b268564v7y735ewrq2324": "EPkJXzJkPcTFhkaEH83Qcxkm5FbpS5ZS"
}
url = "https://www.kuwo.cn/search/searchMusicBykeyWord"
params = {
"vipver": "1",
"client": "kt",
"ft": "music",
"cluster": "0",
"strategy": "2012",
"encoding": "utf8",
"rformat": "json",
"mobi": "1",
"issubtitle": "1",
"show_copyright_off": "1",
"pn": "0",
"rn": "20",
"all": "山楂树之恋"
}
response = requests.get(url, headers=headers, cookies=cookies, params=params)

json_data = response.json()
return json_data


if __name__ == '__main__':
searchmusicbykeyword_api = SearchmusicbykeywordApi()
data = searchmusicbykeyword_api.get_searchmusicbykeyword()
print(data)