无敌军爷
发表于 2015-6-13 10:04:21
神马东东
s1986q
发表于 2015-6-13 10:35:01
谢谢楼主,楼主辛苦了。
发表于 2015-6-13 10:59:53
我来看看!!!
HO自由
发表于 2015-6-13 11:00:07
激动人心的时刻到了,但还是要老老实实,理智看待,满足一下
sunzhanpe
发表于 2015-6-13 15:32:52
see see I come
冰释年华
发表于 2015-6-13 17:09:22
什么东西。。。
【Bury】
发表于 2015-6-13 17:18:11
{:5_111:}
大冬瓜
发表于 2015-6-13 20:37:38
:huffy::huffy::huffy::huffy:
pony_
发表于 2015-6-13 22:09:06
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
import requests
from lxml import etree
def get_urls(url, time):
source_code = requests.get(url, timeout = time).text
selector = etree.HTML(source_code)
urls = selector.xpath('/html/body/div/div/div/ul/li/div/a/@href')
return urls
def get_total_page(url, time):
source_code = requests.get(url, timeout = time).text
total_page = re.search(r'/<b>(\d+)</b>', source_code).group(1)
return total_page
def get_picture_url(url, time):
source_code = requests.get(url, timeout = time).text
selector = etree.HTML(source_code)
picture_url = selector.xpath('//*[@id="Cnt-Main-Article-QQ"]/p/img/@src')
return picture_url
def download_picture(url, time):
picture = requests.get(url, timeout = time).content
filename = re.sub(r'.*/', '', url)
open('pic/' + filename, 'wb').write(picture)
if __name__ == '__main__':
url = 'http://www.nzchinese.com/tupian/renti/'
time = 60
urls = get_urls(url, time)
count = 1
for each_url in urls:
total_page = get_total_page(each_url, time)
all_page_url =
for i in range(2, int(total_page) + 1):
new_page_url = re.sub(r'(\d+)(.html$)', '\1' + str(i) + '\2', each_url, time)
all_page_url.append(new_page_url)
for each_page_url in all_page_url:
picture_url = get_picture_url(each_page_url, time)
for each_picture_url in picture_url:
download_picture(each_picture_url, time)
print 'Downloading picture ' + str(count) + '...'
count += 1
wdwxdf
发表于 2015-6-13 22:50:57
:lol::lol:
292597185
发表于 2015-6-14 09:38:09
楼主专注开房三十年??
kmaster
发表于 2015-6-14 17:46:33
dddddd
xingzhe
发表于 2015-6-14 19:02:06
水的无节操:shock::shock::shock::shock:
张飞online
发表于 2015-6-14 19:28:52
:shock:
小学期
发表于 2015-6-15 10:22:57
看看
sunhongbao1
发表于 2015-6-15 10:37:25
到底是什么秘密
caster
发表于 2015-6-15 11:02:17
强烈支持楼主ing……
caster
发表于 2015-6-15 11:02:57
激动人心,无法言表!!!!!!!!!
1735648089
发表于 2015-6-15 15:03:29
666666666
铿仔
发表于 2015-6-15 15:03:59
强烈支持楼主ing……