爬虫之 必应壁纸

mac2022-06-30  94

爬虫之 必应壁纸

https://bing.ioliu.cn/?p={i} i为爬取的页数

import re import requests import os if not os.path.exists('必应壁纸'): os.mkdir('必应壁纸') # 获取网页地址信息 i = 1 while i<50: response = requests.get(f'https://bing.ioliu.cn/?p={i}') data = response.text i+=1 # 获取当前页面图片的链接 results = re.findall('data-progressive="(.*?)"', data) for result in results: print(result) img_response = requests.get(result) img_data = img_response.content img_name = result.split('/')[-1].split('_')[0] + '.jpg' img_name = os.path.join('必应壁纸', img_name) with open(img_name,'wb') as t: t.write(img_data) print("success")

转载于:https://www.cnblogs.com/dadazunzhe/p/11232554.html

相关资源:贪吃蛇屏幕保护程序
最新回复(0)