QQFM
获取list 网页源代码
https://fm.qq.com/album/rd000ykAOz1jIKCK
数据处理
data_str = html_text[html_text.index(‘showIdList: ‘)+12:]
定位‘showIdList’的index,除去这12个字符,取得后面的所有内容
data_str = data_str[:data_str.index(‘,displayPageNum’)]
定位‘displayPageNum’的index,冒号在前表示获取index之前的数据,取得中间的List
vkey
def get_vkey(showmapid):
headers = {
'referer': 'https://fm.qq.com/show/' + showmapid + '__',
'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/80.0.3987.132 Safari/537.36',
'x-requested-with': 'XMLHttpRequest',
}
url = 'https://fm.qq.com/webapp/json/fm_vkey/GetVkey?&guid=10000&inCharset=utf-8&outCharset=utf-8&_=' + str(time.time())
response = requests.get(url,headers = headers)
json_data = json.loads(response.text)
return json_data['data']['vkey']
每一个id都有一个对应的vkey,vkey对应每一个音频的downloadURL。
调用IDM下载文件(真的快,还方便)
from subprocess import call
IDM = r'D:\Internet Download Manager\IDMan.exe'
DownPath = r'D:\audio'
call([IDM, '/d',play_url, '/p',DownPath, '/f', name, '/n', '/a'])
效果图
