爬妹子图

# __author:Dell
# date: 2022/6/13
# coding:utf-8
#爬虫妹子图代码

import requests,re
#url = 'https://www.tupianzj.com/meinv/mm/meizitu/'
url = 'https://www.tupianzj.com/meinv/siwa/'
haderes = {'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.54 Safari/537.36'}
response = requests.get(url=url,headers=haderes)
data = response.text
#res = re.findall("https://img.lianzhixiu.com/uploads/allimg/.*?/.*?.jpg",data) #妹子图
res = re.findall("https://img.lianzhixiu.com/uploads/.*?/.*?.jpg",data)
i = 75
print("开始下载中,请稍后....")
for k in res:
    repo = requests.get(k)
    if repo.status_code == requests.codes.ok:
        with open('pic\\' + str(i) + '.jpg', 'wb') as f:
            f.write(repo.content)
            f.close()
            i += 1
    else:
        exit("请求失败...")

print("下载完成")
posted @ 2022-06-14 14:10  Mis168  阅读(185)  评论(0)    收藏  举报