标签:lan data pen ade java pytho jpg inpu 信息
import requests
import re
from threading import Thread
from bs4 import BeautifulSoup
import openpyxl
import json
class MUSIC(Thread):
def run(self):
songname=input("请输入歌名:")
da={
‘input‘: songname,
‘filter‘: ‘name‘,
‘type‘: ‘kugou‘,
‘page‘: ‘1‘
}
header={
"user-agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3947.100 Safari/537.36",
"x-requested-with":"XMLHttpRequest"
}
iic=[]
# 发送请求,抓取信息
res = requests.post("http://music.xionggd.com/",headers=header,data=da)
respon=res.json()
for i in range(0,len(respon[‘data‘])):
link=respon[‘data‘][i][‘link‘]
title=respon[‘data‘][i][‘title‘]
author=respon[‘data‘][i][‘author‘]
lrc=respon[‘data‘][i][‘lrc‘]
url=respon[‘data‘][i][‘url‘]
pic=respon[‘data‘][i][‘pic‘]
print(i,‘歌手:‘+author,‘歌名:‘+title)
j=int(input(‘请输入序列号:‘))
link = respon[‘data‘][j][‘link‘]
title = respon[‘data‘][j][‘title‘]
author = respon[‘data‘][j][‘author‘]
lrc = respon[‘data‘][j][‘lrc‘]
url = respon[‘data‘][j][‘url‘]
pic = respon[‘data‘][j][‘pic‘]
lrc = re.sub(‘\r\n‘, ‘‘, lrc)
lrc = lrc.replace(‘\ufeff‘, ‘‘)
iic.append(lrc)
word= "{name:‘"+title+"‘,artist:‘"+author+"‘,url:‘"+url+"‘,cover:‘"+pic+"‘,"+‘lrc:"‘+iic[0]+‘"},‘
print(word)
if __name__ == ‘__main__‘:
t=MUSIC()
t.start()
标签:lan data pen ade java pytho jpg inpu 信息
原文地址:https://www.cnblogs.com/weitongxue/p/14854669.html