不用查找节点,不用调用事件,也能实现网页模拟操作吗?答案是肯定的,而且比传统的网页模拟效率高上几十倍,如果加上多线程,甚至可以高上几百倍、几千倍。
115网盘不错,就是一直要续期,我们可以尝试着写个工具来替代我们的续期操作,要是加入自动启动项,那就更方便了。我写的这个只是实现了最简单的列文件、续期全部文件的功能,给大家作一个参考,大家可以自行扩展,体验
post 的魅力。
// 导入库
import inet.http;
import web.url;
// 配置登录信息
var account = "aautotest"; // 用户名
var passwd = "asd123"; // 密 码
io.open();
execute( "color F0" )
execute( "title 115 网盘自动续期工具 - Built by AAuto Quicker" );
try {
io.print( "正在登录 115..." );
var http = inet.http();
var data = http.down(
"",
"login[account]=" + web.url.encode(account) + "&" +
"login[passwd]=" + web.url.encode(passwd)
);
data = string.fromto( data );
var account2 = string.match( data, '([^\>]+)的账号' );
if( !account2 ) {
io.print( "登录失败,按下任意键结束" );
execute( "pause > nul" );
io.close();
} else {
io.print( account2 + " 登录成功,正在获取文件列表..." );
data = http.down( "" );
data = string.fromto( data );
var pageCount = string.match( data, "\共 (\d+) 页\" );
if( !pageCount ) {
pageCount = 1;
}
execute( "cls" );
io.print( '文件列表:\r\nID', "文件名" );
var tblFiles = {};
for (page = 1; pageCount; 1) {
data = http.down( "&s=" + 10 * (page - 1) );
data = string.fromto( data );
for( fileID, fileName in string.gmatch( data, "fileid='(\d+)' filename='([^']+)'" ) ) {
io.print( fileID, fileName );
table.push( tblFiles, fileID );
}
}
var result = "";
while( result != "Y" && result != "N" ) {
io.stdout.write( '\r\n是否进行全部续期(Y/N): ');
result = string.upper( io.stdin.read() );
}
if( result == "Y" ) {
var nCurrect = 0;
for( k, v in tblFiles ) {
execute( "cls" );
nCurrect++;
io.print( "正在续期第 " + nCurrect + " / " + #tblFiles + " 个文件..." );
http.down( "" + v );
}
execute( "cls" );
io.print( "续期完毕,按任意键结束" );
execute( "pause > nul" );
}
io.print( "正在退出..." );
http.down( "" );
io.close();
}
} catch( e ) {
io.print( "网络故障,请稍后再试" );
execute( "pause" );
io.close();
}
阅读(1213) | 评论(0) | 转发(0) |