# coding = utf-8
"""
爬取百度壁纸图片
"""
/*
优秀开源电商系统学习地址:http://github.crmeb.net/u/fei
*/
import requests,re,time,warnings,os
warnings.filterwarnings("ignore")
def search(key_word):
# 百度获取风景壁纸图片Url地址
search_url = "https://image.baidu.com/search/index?tn=baiduimage&ipn=r&ct=201326592&cl=2&lm=-1&st=-1&fm=result&fr=&sf=1&fmq=1579231773363_R&pv=&ic=0&nc=1&z=0&hd=0&latest=0©right=0&se=1&showtab=0&fb=0&width=&height=&face=0&istype=2&ie=utf-8&sid=&word=" + key_word + ""
response = requests.get(url=search_url, verify=False)
return response.text
def find_picture_url(response):
# 正则查找字符串结果中的图片Url地址返回列表
regex = re.compile(r'"ob
python 使用 requests 库爬取百度图片脚本
最新推荐文章于 2022-06-09 15:36:20 发布
本文介绍了如何使用Python的requests库来爬取百度图片的步骤,包括发送HTTP请求,解析HTML,提取图片URL,并下载图片。通过实例代码详细展示了整个过程。
摘要由CSDN通过智能技术生成