博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
169美女图片
阅读量:6961 次
发布时间:2019-06-27

本文共 900 字,大约阅读时间需要 3 分钟。

import requests

# from lxml import etree
from pyquery import PyQuery
# from bs4 import BeautifulSoup

count = 1

url = "https://www.169tp.com/rentiyishu/"
headers = {'User-Agent':'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36'}
reponse = requests.get(url,headers=headers).text
# print(reponse)
doc = PyQuery(reponse)
url_data = doc('.product01 li a').items()
for i in url_data:
xulie = i.attr('href')
# print(xulie)
reponse1 = requests.get(xulie,headers=headers).text
# print(reponse1)
doc2 = PyQuery(reponse1)
tupian = doc2('.big_img p img').items()
for k in tupian:
img = k.attr('src')
# title = k.attr('alt')
# print(img)

 

contont = requests.get(img,headers=headers)

with open('.\模特\美女{}.jpg'.format(count),'wb') as f:
f.write(contont.content)
print('已经下载了{}张'.format(count))
count+=1

转载于:https://www.cnblogs.com/LQ970811/p/10469606.html

你可能感兴趣的文章
Kafka的底层实现原理
查看>>
CAS实现单点登录实例源码
查看>>
JEESZ-Zookeeper集群安装
查看>>
Dubbo背景和简介
查看>>
vue-router的HTML5 History 模式设置
查看>>
Neo 虚拟机
查看>>
Pycharm上Django的使用 Day10
查看>>
node上的redis调用优化示例
查看>>
Jenkinsfile
查看>>
CSS:父子元素浮动分析和清除浮动
查看>>
springboot配置Druid数据源
查看>>
IT兄弟连 JavaWeb教程 过滤器与监听器经典面试题
查看>>
[喵咪BELK实战(2)] elasticsearch+kibana搭建
查看>>
关于 SSHKey
查看>>
struts-ObjectFactory
查看>>
eclipse查看版本
查看>>
Hadoop面试45个题目及答案
查看>>
nagios的安装
查看>>
【GO 笔记】 20180907 golang GUI
查看>>
Go语言下载、安装、配置、使用
查看>>