批量下载google图片搜索结果,google图片搜索结果,google图片搜索能一
批量下载google图片搜索结果,google图片搜索结果,google图片搜索能一
google图片搜索能一页列出200多个结果,对于需要搜集很多图片的人来说,一张张下载过于麻烦
本脚本 需要先用浏览器搜索出结果,而后需要保存搜索结果页面,假设为 filename.html
而后修改脚本种的DIR_TARGET,也就是存放文件夹,之后 在终端运行本脚本:./test.py filename.html 即可
注意,下载程序使用了wget
备注:firefox,ubuntu10.10, python2.6.6
#!/usr/bin/python# -*- coding: utf-8 -*-import sys,os,reDIR_TARGET="/home/ray/图片/down"reg=re.compile("((?<=imgurl=)http.*?\\.(jpg|gif|png|bmp|jpeg))")#正则表达式匹配下载地址fd=file(sys.argv[1],'r')html=fd.read()fd.close()results=reg.findall(html)if results: os.chdir(DIR_TARGET) for one in results: dlcommand="wget -Nnv %s" %(one[0]) if os.system(dlcommand)==0: print "Download %s ..." %(one[0]) else: print "Fail download %s ..." %(one[0]) print "done"else: print "empty results"#该片段来自于http://byrx.net
相关内容
- Gauss-Legendre integration in Python,,''' I = gaus
- Python 写入CSV,python写入csv,# _*_ coding
- Levenshtein字符串相似度,Levenshtein字符串,概述Levenshtei
- 扫雷,,输入 x/y 选择位置扫
- 使用PIL给图片加水印的工具类 - Python,,#! /usr/bin/
- 多线程爬虫批量下载pcgame图片url,保存为xml,pcgamexml
- 使用gevent多线程下载豆瓣音乐,gevent豆瓣,使用gevent比
- python通过shutil实现快速文件拷贝,pythonshutil,from shutil
- python基数排序算法,python基数排序,from random
- python 读写excel类,python读写excel,# coding=UTF
评论关闭