本文的文字及图片来源于网络,仅供学习、交流使用,不具有任何商业用途,如有问题请及时联系我们以作处理。
PS:如有需要Python学习资料的小伙伴可以加点击下方链接自行获取
python免费学习资料以及群交流解答点击即可加入
import requests
import pprint
url = 'https://bird.ioliu.cn/v2'
params = {
'url': 'http://wallpaper.apc.360.cn/index.php?c=WallPaper&start=1&count=12&from=360chrome&a=getAppsByOrder&order=create_time'
}
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36'
}
response = requests.get(url=url, params=params, headers=headers)
html_data = response.json()
urls = html_data['data']
for url in urls:
img_url = url['url']
title = url['utag']
response = requests.get(url=img_url, headers=headers)
path = 'D:\\python\\demo\\电脑壁纸\\img\\' + title + '.jpg'
with open(path, mode='wb') as f:
f.write(response.content)
print(img_url)