使用爬虫爬取APEX高清载入图
原网址:https://wiki.biligame.com/apex/Loading_Screen
html分析:
图片的地址在img标签中

import requests
from bs4 import BeautifulSoup
# 获取连接
response = requests.get('https://wiki.biligame.com/apex/Loading_Screen')
# 获取载入图界面
html = response.content
# 创建bs对象并使用lxml解析(或使用html.parser)
soup = BeautifulSoup(html, 'lxml')
# 找到图片列表所在table
table = soup.find(name='table',class_='wikitable')
# 获取所有图片连接
urls = [img['src'] for img in table.find_all('img')]
# 下载图片并保存
for index,url in enumerate(urls):
with open(f'output/{index}.jpg','wb+') as f:
picture = requests.get(url).content
f.write(picture)
print('download',index)

浙公网安备 33010602011771号