![f89d74c6288643c59e68638ead9092cf.png](https://i-blog.csdnimg.cn/blog_migrate/215f0614f0c9f77f522ddb35efb57d27.jpeg)
Python爬虫,python秀设计素材爬取及下载
秀设计素材爬取及下载
![2f47b272af0e74ab809e450031b16db5.png](https://i-blog.csdnimg.cn/blog_migrate/83f56a6ccee4681ca4a90a0ee6db3f39.jpeg)
#爬取秀设计素材
import requests
import re
import os
url="https://www.xiusheji.com/freebies/4641.html"
html=requests.get(url).text
print(html)
btze=r'<h1>(.+?)</h1>'
title=re.findall(btze,html,re.S)
title=str(title)
print(title)
lxze=r'</a> > <span>(.+?)</span> '
leix=re.findall(lxze,html,re.S)
print(leix)
nrze=r'<section class="art-main">(.+?) </section>'
nr=re.findall(nrze,html,re.S)
print(nr)
scze=r'''百度云盘</a>
<a target="_blank" ng-if="'(.+?)'" href=".+?" md-button class="normal">本地下载</a>'''
sc=re.findall(scze,html,re.S)
print(sc)
scl=sc[0]
print(scl)
scgs=scl[-4:]
print(scl[-4:])
tpze=r'img src="(.+?)"'
tp=re.findall(tpze,str(nr),re.S)
print(tp)
i=0
tpm=[]
n=1
#os.makedirs("./img/"+str(n)+"/", exist_ok=True)
os.makedirs("./img/"+title+"/", exist_ok=True)
scnr=requests.get(scl)
f=open("./img/"+title+"/"+str(n)+scgs,"wb")
f.write(scnr.content)
f.close()
for x in tp:
print(x)
i=i+1
print(x[-3:])
tpmc=str(i)+x[-17:]
print(tpmc)
tpnr=requests.get(x)
f=open("./img/"+title+"/"+tpmc,"wb")
f.write(tpnr.content)
f.close()
设计本资料下载,模型下载
![17bd52d25a23524b6da4a56e1bc03ffa.png](https://i-blog.csdnimg.cn/blog_migrate/5416a7274410f415f976451bd7e29e1f.jpeg)
#设计本资料下载
import requests
import re
import os
url='https://vr.shejiben.com/r262.html'
html=requests.get(url).text
print(html)
nrze=r'''<tr class="bg">
(.+?)</td>
<td><span style=" width:120px; overflow:hidden; float:left;">'''
nr=re.findall(nrze,html,re.S)
nr=str(nr)
print(nr)
scze=r'var loadUrl = '(.+?)';'
sc=re.findall(scze,html,re.S)
print(sc)
scurl=str(sc[0])+'.rar'
print(scurl)
scmze=r'var autoInfoName = '(.+?)';'
scm=re.findall(scmze,html,re.S)
print(scm)
scmc=scm[0]
sctpze=r'var picPath = '(.+?)';'
sctp=re.findall(sctpze,html,re.S)
sct=sctp[0]
sctmz=sct[-8:]
print(sctmz)
os.makedirs('E:Pythoncsimage/'+scmc, exist_ok=True)
r=requests.get(scurl)
with open('E:Pythoncsimage/'+scmc+'/'+'.rar','wb') as f:
f.write(r.content)
ru=requests.get(sct)
with open('E:Pythoncsimage/'+scmc+'/'+sctmz,'wb') as f:
f.write(ru.content)