我猜思路大概是这样,不知道具体怎么写,求解
- 下载登陆页面上的验证码图片
- 在命令行里手动填上验证码
- 用户名,密码,验证码一起post回去
4 回复
@ChefIsAwesome 命令行输入的例子:
var sys = require("sys");
var stdin = process.openStdin();
stdin.addListener("data", function(d) {
// note: d is an object, and when converted to a string it will end with a linefeed.
// so we (rather crudely) account for that with toString() and then substring()
console.log("you entered: [" + d.toString().substring(0, d.length-1) + "]");
});
@ChefIsAwesome 另外有个包叫做prompt
, see:
var prompt = require('prompt');
prompt.start();
prompt.get(['username', 'email'], function (err, result) {
if (err) { return onErr(err); }
console.log('Command-line input received:');
console.log(' Username: ' + result.username);
console.log(' Email: ' + result.email);
});
function onErr(err) {
console.log(err);
return 1;
}