from bs4 import BeautifulSoup
import requests
import os
path = "E:/python/myPython/img1/"
def Info(url):
html = requests.get(url)
soup = BeautifulSoup(html.text,'lxml')
img_list = soup.find_all('img',class_='bqbppdetail lazy')
for img in img_list:
image = img.get('data-original')
title = img.get('title')
# print(image)
#写入文件
with open(path+title+os.path.splitext(image)[-1],'wb') as f:
#根据图片链接下载
img = requests.get(image).content
f.write(img)
url = "https://www.fabiaoqing.com/bqb/detail/id/53854.html"
Info(url)
爬取发表情网的表情包!