url = '
https://c.y.qq.com/soso/fcgi-bin/client_search_cp?ct=24&qqmusic_ver=1298&new_json=1&remoteplace=txt.yqq.song&searchid=62240638881390953&t=0&aggr=1&cr=1&catZhida=1&lossless=0&flag_qc=0&p=1&n=20&w={}&g_tk=5381&loginUin=0&hostUin=0&format=json&inCharset=utf8&outCharset=utf-8¬ice=0&platform=yqq.json&needNewCode=0'.format(urllib.parse.quote(music))
r = requests.get(url, headers=header)
json_music_data = r.json()
list_music = json_music_data['data']['song']['list']
title = list_music[0]['title']
album = list_music[0]['album']['title']
albumid = list_music[0]['album']['mid']
artist = list_music[0]['singer'][0]['name']
singer_amount = len(list_music[0]['singer'])
if singer_amount > 1:
for i in range(1, singer_amount):
artist = artist + ' | ' + list_music[0]['singer'][i]['name']
cover_url = '
http://y.gtimg.cn/music/photo_new/T002R800x800M000{}.jpg'.format(albumid)
urllib.request.urlretrieve(cover_url, cover_file)