默认高品格350k,付费的也可以下载,附件是用pyqt5做的一个小小的界面,这学期开始自学python,第一次发作品展示有点小激动 很浅易,有爱好的可以往下写更多功能 import requests import re songname = input('请输入要查找的歌手或歌名:') req = requests.get('http://www.kuwo.cn/api/www/search/searchMusicBykeyWord?key=' + songname) rid = re.findall('"rid":(.*?),', req.text) name = re.findall('"name":"(.*?)"', req.text) artist = re.findall('"artist":"(.*?)"', req.text) k = 0 for i in rid: print(k + 1, name[k], artist[k]) k += 1 num = int(input("请选择第几个:")) music_info = requests.get('http://m.kuwo.cn/newh5/singles/songinfoandlrc?musicId=%s' % rid[num - 1]) null = 0 a = eval(music_info.text) coopFormats = a['data']['songinfo']['coopFormats'] # 音质 lrclist = a['data']['lrclist'] # 歌词 req_url = requests.get('http://www.kuwo.cn/url?format=mp3&rid=%s&response=url&type=convert_url3&br=%s' % (rid[num - 1], coopFormats[0])) # 字符串-->>字典 audio_url = eval(req_url.text)['url'] print(audio_url) |