求个网页爬虫脚本
管理员

把某网址下的所有图片能趴下来的脚本,求脚本

@adman 这个用Python实现更简单,何必要用Auto.js折腾呢

管理员

k1=9021;//从第7000个帖子开始爬图
function xz(url){
var res = http.get(url);
files.writeBytes("/sdcard/脚本/图片/"+k1+""+i+"."+tmp[0].split(".")[1], res.body.bytes());
}
function cutstr(a, b, c) {
a = a.split(b);
for (i = 1; i < a.length; i++) {
tmp = a[i].split(c);
if (tmp.length > 1) {
try{xz("http://www.zyg01.com/"+tmp[0]);}catch(e){}
log(k1+"
"+i);
}
}
}
d="";
openConsole();
while(k1<10000){
log(k1);
url="http://www.zyg01.com/forum.php?mod=viewthread&tid="+k1;//+"&extra=page%3D1";
var res = http.get(url);
var html = res.body.string();
//log(html);
cutstr(html,"zoomfile="",""");
k1++;
}

还是autojs简单点

管理员

k1=9021;//从第7000个帖子开始爬图
function xz(url){
var res = http.get(url);
files.writeBytes("/sdcard/脚本/图片/"+k1+""+i+"."+tmp[0].split(".")[1], res.body.bytes());
}
function cutstr(a, b, c) {
a = a.split(b);
for (i = 1; i < a.length; i++) {
tmp = a[i].split(c);
if (tmp.length > 1) {
try{xz("http://www.zyg01.com/"+tmp[0]);}catch(e){}
log(k1+"
"+i);
}
}
}
d="";
openConsole();
while(k1<10000){
log(k1);
url="http://www.zyg01.com/forum.php?mod=viewthread&tid="+k1;//+"&extra=page%3D1";
var res = http.get(url);
var html = res.body.string();
//log(html);
cutstr(html,"zoomfile="",""");
k1++;
}

java+jsoup/Python爬

  • 11
    帖子
  • 2296
    浏览

与 Auto.js 的连接断开,我们正在尝试重连,请耐心等待