imgs: [ 'https://img30.360buyimg.com/babel/s1580x830_jfs/t1/109361/24/22897/74054/621ede58E099d37e3/f12730c81df6046a.jpg!cc_1580x830.webp', 'https://img13.360buyimg.com/babel/s1580x830_jfs/t1/96398/30/23715/70228/6221e9d0Ec1b9fe65/f66e2ad76314d6cd.jpg!cc_1580x830.webp' ],
时间: 2023-06-28 14:10:37 浏览: 83
这是一组图片链接,包含两张图片。第一张图片的链接是https://img30.360buyimg.com/babel/s1580x830_jfs/t1/109361/24/22897/74054/621ede58E099d37e3/f12730c81df6046a.jpg!cc_1580x830.webp,第二张图片的链接是https://img13.360buyimg.com/babel/s1580x830_jfs/t1/96398/30/23715/70228/6221e9d0Ec1b9fe65/f66e2ad76314d6cd.jpg!cc_1580x830.webp。这些链接可能指向京东商城上的商品图片。
相关问题
https://pvp.qq.com/web201605/herolist.shtml python爬虫英雌图片
好的,你可以使用Python的Requests和BeautifulSoup库来实现这个爬虫。以下是一个简单的例子代码,可以爬取英雄图片并保存到本地文件夹中:
```python
import requests
from bs4 import BeautifulSoup
# 发送网络请求,获取网页内容
url = 'https://pvp.qq.com/web201605/herolist.shtml'
res = requests.get(url)
# 使用BeautifulSoup解析网页内容
soup = BeautifulSoup(res.text, 'html.parser')
# 获取英雄图片链接
hero_imgs = soup.select('.herolist > li > a > img')
for hero_img in hero_imgs:
img_url = hero_img['src']
# 发送网络请求,下载图片并保存到本地
res = requests.get(img_url)
with open(hero_img['alt']+'.jpg', 'wb') as f:
f.write(res.content)
```
这个代码会将英雄图片下载到当前文件夹,并以英雄名字命名图片文件。你可以根据自己的需要修改代码,例如修改保存路径、图片格式等。
使用python爬取https://www.chzc.edu.cn/info/1025/92906.htm所有图片
可以使用 requests 库和 BeautifulSoup 库来爬取网页,并下载其中的图片。以下是示例代码:
```python
import requests
from bs4 import BeautifulSoup
import os
# 设置请求头部,模拟浏览器请求
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3'}
# 目标网页 URL
url = 'https://www.chzc.edu.cn/info/1025/92906.htm'
# 发送 GET 请求
r = requests.get(url, headers=headers)
# 解析网页
soup = BeautifulSoup(r.text, 'html.parser')
# 获取所有图片链接
img_urls = []
for img in soup.find_all('img'):
img_url = img.get('src')
if img_url and img_url.startswith('/'):
img_url = 'https://www.chzc.edu.cn' + img_url
img_urls.append(img_url)
# 创建保存图片的目录
if not os.path.exists('imgs'):
os.mkdir('imgs')
# 下载图片
for i, img_url in enumerate(img_urls):
try:
img_data = requests.get(img_url, headers=headers).content
with open(f'imgs/img_{i}.jpg', 'wb') as f:
f.write(img_data)
print(f'Download {img_url} success!')
except:
print(f'Download {img_url} failed!')
```
代码中,首先使用 requests 库发送 GET 请求获取网页内容,然后使用 BeautifulSoup 库解析网页,获取其中的图片链接。接着,创建一个名为 "imgs" 的目录,用于保存下载的图片。最后,遍历图片链接列表,使用 requests 库下载图片并保存到指定目录下。
需要注意的是,为了避免因为网站对于频繁访问的限制,最好在请求头部中加入一些浏览器相关的头信息。此外,还需要处理图片链接中以 "/" 开头的相对路径,将其转化为绝对路径。