!pip install beautifulsoup4
from bs4 import BeautifulSoup
soup=BeautifulSoup(open('XXX.html',encoding='utf-8'),features='html.parser')
ls=soup.find('div',{'id':'_imageList'}).findAll('img')
res=[]
for i in ls:
#print(i['data-url'])
res.append(i['data-url'])
#print(len(res))
for i,j in enumerate(res[:]):
p=j.split('/')[5].split('?')[0]
!wget $j --user-agent "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36" --referer ="https://xxx.x.net" -O $p
利用BeautifulSoup解析并下载文件
最新推荐文章于 2023-02-21 16:22:55 发布