[Python] 纯文本查看 复制代码
import requests
import os
# 图片链接列表
urls = [
"https://s1pic.kagirl.cn/qy_13743729371857?imageMogr2/auto-orient/thumbnail/1000x/",
"https://s1pic.kagirl.cn/qy_13743729428970?imageMogr2/auto-orient/thumbnail/1000x/",
"https://s1pic.kagirl.cn/qy_13743729488665?imageMogr2/auto-orient/thumbnail/1000x/",
"https://s1pic.kagirl.cn/qy_13743729533092?imageMogr2/auto-orient/thumbnail/1000x/",
"https://s1pic.kagirl.cn/qy_13743729584424?imageMogr2/auto-orient/thumbnail/1000x/",
"https://s1pic.kagirl.cn/qy_13743729654667?imageMogr2/auto-orient/thumbnail/1000x/",
"https://s1pic.kagirl.cn/qy_13743729746289?imageMogr2/auto-orient/thumbnail/1000x/",
"https://s1pic.kagirl.cn/qy_13743729794723?imageMogr2/auto-orient/thumbnail/1000x/",
"https://s1pic.kagirl.cn/qy_13743752265844?imageMogr2/auto-orient/thumbnail/1000x/",
"https://s1pic.kagirl.cn/qy_13743752335381?imageMogr2/auto-orient/thumbnail/1000x/",
"https://s1pic.kagirl.cn/qy_13743752369095?imageMogr2/auto-orient/thumbnail/1000x/",
"https://s1pic.kagirl.cn/qy_13743752436661?imageMogr2/auto-orient/thumbnail/1000x/",
"https://s1pic.kagirl.cn/qy_13743752492655?imageMogr2/auto-orient/thumbnail/1000x/",
"https://s1pic.kagirl.cn/qy_13743752546250?imageMogr2/auto-orient/thumbnail/1000x/",
"https://s1pic.kagirl.cn/qy_13743752605184?imageMogr2/auto-orient/thumbnail/1000x/",
"https://s1pic.kagirl.cn/qy_13743752641104?imageMogr2/auto-orient/thumbnail/1000x/",
"https://s1pic.kagirl.cn/qy_13743752672225?imageMogr2/auto-orient/thumbnail/1000x/",
"https://s1pic.kagirl.cn/qy_13743757323236?imageMogr2/auto-orient/thumbnail/1000x/",
"https://s1pic.kagirl.cn/qy_13743757337714?imageMogr2/auto-orient/thumbnail/1000x/",
"https://s1pic.kagirl.cn/qy_13743757374234?imageMogr2/auto-orient/thumbnail/1000x/",
"https://s1pic.kagirl.cn/qy_13743757411451?imageMogr2/auto-orient/thumbnail/1000x/",
"https://s1pic.kagirl.cn/qy_13743757476848?imageMogr2/auto-orient/thumbnail/1000x/",
"https://s1pic.kagirl.cn/qy_13743757506046?imageMogr2/auto-orient/thumbnail/1000x/",
"https://s1pic.kagirl.cn/qy_13743757554594?imageMogr2/auto-orient/thumbnail/1000x/",
"https://s1pic.kagirl.cn/qy_13743757594234?imageMogr2/auto-orient/thumbnail/1000x/",
"https://s1pic.kagirl.cn/qy_13743757651275?imageMogr2/auto-orient/thumbnail/1000x/"
]
# 请求头
headers = {
'Host': 's1pic.kagirl.cn',
'Method': 'GET',
'Path': '/qy_13743729428970?imageMogr2/auto-orient/thumbnail/1000x/',
'Scheme': 'https',
'Accept': 'image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8',
'Accept-Encoding': 'gzip, deflate, br, zstd',
'Accept-Language': 'zh-CN,zh;q=0.9',
'Cache-Control': 'no-cache',
'DNT': '1',
'Pragma': 'no-cache',
'Referer': 'https://go07.gondar.cn/',
'Sec-CH-UA': '"Chromium";v="128", "Not;A=Brand";v="24", "Google Chrome";v="128"',
'Sec-CH-UA-Mobile': '?0',
'Sec-CH-UA-Platform': '"Windows"',
'Sec-Fetch-Dest': 'image',
'Sec-Fetch-Mode': 'no-cors',
'Sec-Fetch-Site': 'cross-site',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36'
}
# 下载图片并保存
for i, url in enumerate(urls):
response = requests.get(url, headers=headers)
if response.status_code == 200:
file_name = f"image_{i + 1}.webp"
with open(file_name, 'wb') as f:
f.write(response.content)
print(f'下载成功: {file_name}')
else:
print(f'下载失败: {url}, 状态码: {response.status_code}')