import requests
from pyquery import PyQuery
count = 1
url = "https://www.169tp.com/diannaobizhi/"
headers = {
'User-Agent': ' Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36'}
res = requests.get(url).content.decode('gbk')

doc = PyQuery(res)
jiexi = doc('.product011 li a').items()
for i in jiexi:
data_url = i.attr('href')
data_title = i.attr('alt')
# print(data_title, data_url)

img_url = requests.get(data_url).content.decode('gbk')
doc2 = PyQuery(img_url)
nier = doc2('.big_img p img').items()
for k in nier:
img = k.attr('src')

neirong =requests.get(img)

with open('./电脑壁纸/壁纸{}.jpg'.format(count),'wb') as f:
f.write(neirong.content)
print("已经下载了%d张图片"%(count))
count +=1

Comput_picture的更多相关文章

随机推荐

  1. 2015百度之星初赛2 1005 序列变换(LIS变形)

    LIS(非严格):首先我想到了LIS.然而总认为有点不正确:每一个数先减去它的下标.防止以下的情况发生:(转载) 3 增加序列是1,2,2,2,3,这样求上升子序列是3.也就是要改动2个,可是中间的两 ...

  2. 足球大数据:致足球怀疑论者-The Counter(s)-Reformation反教条改革

    足球大数据:致足球怀疑论者-The Counter(s)-Reformation反教条改革 注:本序列文章都是本人对<The Numbers Game>书(豆瓣链接http://book. ...

  3. vs输出窗口,显示build的时间

    https://stackoverflow.com/questions/82128/displaying-build-times-in-visual-studio Tools... Options.. ...

  4. ConfigurationSection

    https://msdn.microsoft.com/en-us/library/system.configuration.configurationsection(v=vs.110).aspx Re ...

  5. No mapping found for HTTP request with URI [/test2/test/add.json] in DispatcherServlet with name 'dispatcher'

    查看spring-mvc.xml中扫描包路径配置是否正确: <!-- 扫描controller(controller层注入) --> <context:component-scan ...

  6. ViewPager中的数据更新

    getItemPosition(Object object) { return POSITION_NONE;} 出现的问题: 我希望能够通过调用 mAdapter.notifyDataSetChang ...

  7. Css border样式

    1 四个边框 border-left 设置左边框,一般单独设置左边框样式使用border-right 设置右边框,一般单独设置右边框样式使用border-top 设置上边框,一般单独设置上边框样式使用 ...

  8. 976 C. Nested Segments

    You are given a sequence a1, a2, ..., an of one-dimensional segments numbered 1 through n. Your task ...

  9. [转载][来自csdn]RTS和CTS是什么意思?

    原文链接: http://blog.csdn.net/zmq5411/article/details/6280332 这篇文章看着挺好,明白易懂,顺手转过来 34RTS和CTS是什么意思? 解释一:R ...

  10. 【IDEA】Error: java: Compliance level '1.6' is incompatible with target level '1.8'. A compliance level '1.8' or better is required解决办法

    在运行的时候常常出现如下错误: Error: java: Compliance level '1.6' is incompatible with target level '1.8'. A compl ...