import requests
import json
import csv
import threading
url = 'https://c.y.qq.com/soso/fcgi-bin/client_search_cp'
def get_song():
for x in range(1,6):
params = {
'ct': '24',
'qqmusic_ver': '1298',
'new_json': '1',
'remoteplace': 'sizer.yqq.song_next',
'searchid': '64405487069162918',
't': '0',
'aggr': '1',
'cr': '1',
'catZhida': '1',
'lossless': '0',
'flag_qc': '0',
'p': str(x + 1),
'n': '20',
'w': '陈慧娴',
'g_tk': '5381',
'loginUin': '0',
'hostUin': '0',
'format': 'json',
'inCharset': 'utf8',
'outCharset': 'utf-8',
'notice': '0',
'platform': 'yqq.json',
'needNewCode': '0'
}
res = requests.get(url,params = params)
json_music = res.json()
list_music = json_music['data']['song']['list']
for music in list_music:
name = music['name']
print(music['name'])
#csv_file = open('jay.csv','w',newline= '',encoding = 'utf-8')
#writer = csv.writer(csv_file)
#writer.writerow(['song'])
def main():
for i in range(4):
th = threading.Thread(target = get_song)
th.start()
if __name__ == '__main__':
main()