[Python] 爬取美女图片(修改版)

a1辅助网提供[Python] 爬取美女图片(修改版)的下载地址,长期提供破解软件,各种线报福利等,61952是一个很好的福利资源网站

沉心云 发表于 2021-3-17 22:13
太强了,必须支持一波

太强了,必须支持一波,厉害厉害

太强了,必须支持一波[Python] 爬取美女图片(修改版)
支持支持   学到了
原帖子地址:https://www.a1fz.com/thread-1393754-1-1.html
@在外DE孩子
相较于原版,增加了自定义关键词。
运行截图:

[Python] 纯文本查看 复制代码
from bs4 import BeautifulSoup  import requests,re,os    headers = {          'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36'      }  def Get_Url(url):      response = requests.get(url, headers=headers).text      soup = BeautifulSoup(response,'html.parser')      for data in soup.find_all('a',class_='list-title text-md h-2x'):          url_data = data.get('href')          urls = "https://www.vmgirls.com/" + str(url_data)          Down_Image(urls)          print('-----------------------------------------------')          print(urls)    def Down_Image(url):      response = requests.get(url, headers=headers).text      soup = BeautifulSoup(response, 'html.parser')        image_url = soup.find_all('img')      for data in  image_url:          image_type = data.get('src').split('.')[-1]          if image_type == 'jpg' or image_type == 'jpeg' or image_type == 'png':              url_data = data.get('src')              # print(url_data)                dir_name = soup.find(class_='post-title h1').string              if not os.path.exists(dir_name):                  os.mkdir(dir_name)                  # print(dir_name)                image = requests.get("https:" + str(url_data), headers=headers).content              file_name = url_data.split('/')[-1]              # print(file_name)              with open(dir_name + '/' + file_name, 'wb') as f:                  f.write(image)                  print('正在写入----->' + dir_name + '/' + file_name)      if __name__ == '__main__':      print(' ---------------------------------------------------------------------')      print('|                                                                     |')      print('|               Author:culprit --- 52pojie                            |')      print('|                                                                     |')      print(' ---------------------------------------------------------------------')      print('支持搜索关键词(例如少女、小姐姐、青春。。。)')      key = input('请输入关键词(默认回车不输入):')      if key == '':          url = "https://www.vmgirls.com/"      else:          url = "https://www.vmgirls.com/?s=" + key      Get_Url(url)    

部分文章来自互联网,侵权删除www.a1fz.com/

www.a1fz.com A1fz网专注于福利分享,各种破解软件学习资料,视频教程等等,如有侵权告知管理员删除
A1fz.com,福利吧,宅男福利,宅男,福利社,福利,有福利 » [Python] 爬取美女图片(修改版)

发表评论