1 Star 0 Fork 0

耿直的小爬虫/Climb the bucket map

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
从数据库中下载(2).py 942 Bytes
一键复制 编辑 原始数据 按行查看 历史
import requests
from redis import StrictRedis
import requests.exceptions as e
import os
def test():
try:
dizhi=input('请输入你要保存的文件位置(如F:/......):')
cu=dizhi.replace("\\",'/')
o=1
redis = StrictRedis(host='172.18.200.5', port=6379, db=1, password='')
redis.srem('斗图网','None')
for i in redis.smembers('斗图网'):
t=str(i,encoding='utf8')
#print(t)
r=t.split('/')[-1]
opp='/'+r
#dizhi='F:/斗图/'+r
req=requests.get(t)
if not os.path.exists(cu):
os.mkdir(cu)
with open(cu+opp,'wb')as p:
p.write(req.content)
print('保存完毕 已保存了%d张'%o)
o+=1
except e.MissingSchema as p:
print('出现异常:',p.args)
pass
test()
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/testp2y/Climb-the-bucket-map.git
git@gitee.com:testp2y/Climb-the-bucket-map.git
testp2y
Climb-the-bucket-map
Climb the bucket map
master

搜索帮助