哈哈,找不到快手语言的编辑器,就按照js的来用吧,反正我感觉语法类似。
快手(aauto),开发桌面软件的一个利器,具体情况可以问度娘。
这段代码,是用来分析书香电子书排行榜中小说的下载地址的,不过这个地址貌似只能用迅雷等工具下载,直接点击下载不了,不知道为什么。
用到的知识点有hash表、数组、下载源码及简单的io操作。知识很基础,给自己留存资料,如有新手学习,自认为也是个不错的参考


import win.ui;
import web.mshtml
mainForm = ..win.form(text="AAuto工程3";right=176;bottom=99)
mainForm.add(button={cls="button";text="分析地址";left=30;top=30;right=130;bottom=70;z=1})
//采集指定块的小说地址
var ids = {1;2;3;4;5;6;7;8;9}
mainForm.button.oncommand = function(id,event){
//定义hash表,存储下载地址
tdist := {};
//获取源码
http = web.mshtml();
http.document.designMode = "on"
http.go("http://www.sxcnw.net/topjs.html")
//获取列表块
eles = http.queryEles( className = "ranks_box green_box")
for(i=1;#ids){
//通过正则获取a标签内容
for m in string.gmatch(eles[ids[i]].innerhtml,\'href="(.*?)"\') {
//屏蔽更多的链接
s,e = string.indexOf(m,".html")
if( s )
continue ;
//将a标签内容存起来,进行重复过滤
var key = m
if( not tdist[key]){
tdist[key] = "http://www.sxcnw.net" + m
}
}
}
//将最后分析结果放到d盘下
file = io.open("d:/urls.txt","w")
for(k,v in tdist)
file.write(downloadurl(v)+\'\r\n\')
file.close()
mainForm.msgbox("处理完毕")
}
//根据之前a标签地址,分析出真实下载地址
//不知道怎么回事,只能通过迅雷下载,不过不影响我最终使用,就先这样了
downloadurl = function(url){
http = web.mshtml();
http.document.designMode = "on"
http.go(url)
eles = http.queryEles(className = "thelinks")
downurl = "http://www.sxcnw.net/"+string.match(eles[2].innerhtml,\'href="(.*?)"\')
downurl = string.replace(downurl,"amp;","")
http.go(downurl)
eles = http.queryEles(className="flash")
downurl = string.match(eles.innerhtml,\'href="(.*?)"\')
return downurl;
}
mainForm.show()
win.loopMessage();
书香电子书下载地址