本帖最后由 wushaominkk 于 2018-9-17 17:14 编辑
你知道LOL总共多少套皮肤吗?用python就可以轻易获取统计
拿来当桌面背景美滋滋
爬取地址:http://lol.qq.com/web201310/info-heros.shtml
[Python] 纯文本查看 复制代码 import requests,re,urllib
header = { 'Host': 'c.y.qq.com','Referer': 'http://c.y.qq.com/','User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:62.0) Gecko/20100101 Firefox/62.0','Host':'lol.qq.com','Referer':'http://lol.qq.com/web201310/info-defail.shtml?id=Diana'}
url='http://lol.qq.com/web201310/js/herovideo.js'
date=requests.get(url,headers=header)
html = date.text
linke=re.findall('"(\d+(\.\d+)?)": "(.*?)"',html,re.S)
for i,l in enumerate(linke):
name=l[2]
url='http://lol.qq.com/biz/hero/%s.js'%name
da = urllib.request.Request(url, headers=header)
da = urllib.request.urlopen(da)
da = requests.get(url, headers=header)
html=da.text
html=re.findall('"skins":\[{(.*?)}\]',html,re.S)
html=re.findall('"id":"(.*?)"',str(html),re.S)
for l in html:
url='http://ossweb-img.qq.com/images/lol/web201310/skin/big%s.jpg'%l
url = requests.get(url).content
f = open('E:\\img\\{}.jpg'.format(l), 'wb')
f.write(url)
f.close()
print("%s下载成功"%l)
|