如何将网站上面的图片批量下载--各位能人请进[高分]

scriptren 2009-07-18 01:05:47
比如一个网站上面只有目录和图片
http://www.xxx.com/xxx/xx/*.jpg
没有任何的htm xml等文件链接
但目录已经有一定顺序
如xxx中的 201106 这个是年份月份的主目录
主目录下xx还面还有以1.2.3.4...命名的无数的分目录
分目录下面还有以1.jpg.2.jpg顺序排列好的图片名称
我想把他们穷举下载下来
每个年份穷举12个主目录
每个分目录穷举1-200个分目录
每个分目录穷举1-20个图
每个分目录的文件可以独立文件夹
大家说说用什么方法比较好
有什么软件可以比较轻松实现这个过程
...全文
257 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
liuyonghong159632 2009-11-16
  • 打赏
  • 举报
回复
那你就用 FlashGet 算了!
你新建一个批量下载
对一个目录下的 所有以数字命名 且有规律的图片 可以进行4、5位的匹配
基本能够达到要求
至于 上一级目录 你就手动 操作吧!
toury 2009-07-20
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 scriptren 的回复:]
楼上高人的方法 也不错
但是好像不能执行
因为我这里没有index.asp 来接收参数
[/Quote]
<form id="form1" name="form1" method="post" action="index.asp?action=test">
把红字改成你自己的页面名称啊。
scriptren 2009-07-19
  • 打赏
  • 举报
回复
楼上高人的方法 也不错
但是好像不能执行
因为我这里没有index.asp 来接收参数
toury 2009-07-18
  • 打赏
  • 举报
回复
帮你简单的写了一下,不知道是否符合你的要求.如果有问题请检查FSO是否开启

<%@LANGUAGE=VBSCRIPT CODEPAGE="936"%>
<script>
function chk(s){
if(s.length==0){return;}
var o=document.getElementById("submainnum");
if (o.value.length==0){
alert('请填写每个年份分目录穷举数!'); o.focus(); return false;
}
var o=document.getElementById("imgnum");
if (o.value.length==0){
alert('请填写每个分目录图片穷举数!'); o.focus(); return false;
}
}
</script>
<form id="form1" name="form1" method="post" action="index.asp?action=test">
选择主目录 :
<select name=main onsubmit="return chk(this.value);">
<%
Response.CharSet="GB2312"
with response
.Write"<option value=0 selected>--请选择--</option>"
for i=2000 to 2029
if i-Request.Form("main")=0 then sel=" selected" else sel=""
.Write"<option value='"&i&"' "&sel&">"&i&"</option>"
next
end with
%>
</select>
<br><br>
每个年份分目录穷举数:<input type="text" name="submainnum" id=submainnum value='' size=10 /><br>
每个分目录图片穷举数:<input type="text" name="imgnum" id=imgnum value='' size=10 /><br>
<input type="submit" name="Submit" value=" 下载 " />
</form>
<%
main=Request.Form("main")
if main="" then Response.End

submainnum=Request.Form("submainnum")
imgnum=Request.Form("imgnum")

set fso=server.CreateObject("scripting.filesystemobject")

for i=1 to 12 '每个年份穷举12个主目录
myUrl=main&right("0"&i,2)
for j=1 to submainnum '分目录穷举数
urlSub=myUrl&"/"&j&"/"
for k=1 to imgnum '每分目录图片穷举数
url=urlSub&k&".jpg"
filename="img/"&j&"/"&k&".jpg"
url=" http://www.xxx.com/"&url
path=server.MapPath("img/"&j&"/")
if not fso.FolderExists(path) then
fso.CreateFolder(path)
end if
call SaveRemoteFile(filename,url)
next
next
next
Response.Write err.Description&"<br>"
set fso=nothing

function SaveRemoteFile(LocalFilePath,RemoteFileUrl)
on error resume next
set x = Server.CreateObject("Microsoft.XMLHTTP")
with x
.Open "Get", RemoteFileUrl, false, "", ""
.Send
if x.readyState=4 and x.status=200 then
dim oADS
Set oADS = Server.CreateObject("Adodb.Stream")
with oADS
.Type = 1
.Open
.Write x.ResponseBody
.SaveToFile server.MapPath(LocalFilePath),2
.Cancel(): .Close()
Response.Write err.Description
end with
set oADS=nothing
end if
end With
set x = Nothing
if err then SaveRemoteFile=false else SaveRemoteFile=true
end function
%>

10,608

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 其他
社区管理员
  • 其他
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧