本帖最后由 SQL-sql 于 2020-2-25 13:56 编辑
[Python] 纯文本查看 复制代码 import requests,bs4
url = 'https://c.y.qq.com/soso/fcgi-bin/client_search_cp'
for x in range(5):
params = {
'ct': '24',
'qqmusic_ver': '1298',
'new_json': '1',
'remoteplace': 'txt.yqq.song',
'searchid': '60719417286078739',
't': '0',
'aggr': '1',
'cr': '1',
'catZhida': '1',
'lossless': '0',
'flag_qc': '0',
'p': str(x+1),
'n': '5',
'w': '周杰伦',
'g_tk': '5381',
'loginUin': '0',
'hostUin': '0',
'format': 'json',
'inCharset': 'utf8',
'outCharset': 'utf-8',
'notice': '0',
'platform': 'yqq.json',
'needNewCode': '0'
}
headers = {
'user-agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36'
}
res_music = requests.get(url, params=params)
json_music = res_music.json()
list_music = json_music['data']['song']['list']
for list_m in list_music:
url_1 = 'https://y.qq.com/n/yqq/song/'+list_m['mid']+'.html'
res = requests.get(url_1,headers=headers)
soup = bs4.BeautifulSoup(res.text,'html.parser')
lyric = soup.find('div',class_='lyric__cont_box')
print(url_1)
|