记录千库网的一次自动登录

记录千库网的一次自动登录

月光魔力鸭

2018-09-12 10:24 阅读 1459 喜欢 0 自动登录 千库网

写文章总会需要一些素材,但是好多素材都是收费或有限制的,还是我要求不高,在千库网看了下还不错,有各签到还送VIP,于是就有了想法....

想到就干,由于之前有过经验,所以选用的还是: phantomjs + casperjs

先分析下步骤:

所以难点就在登录上,根据分析找到千库网的QQ登录地址: http://588ku.com/index.php?m=login&a=snsLogin&type=qq&source= 只需要访问这个地址,然后点击登录,再页面中再次访问千库网首页就可以发现已经登录上了。

代码如下:

phantom.outputEncoding = 'utf8';

var url = 'http://588ku.com/';

var casper = require('casper').create({
	verbose: true,
    logLevel: "debug",
    pageSettings: {
         loadImages:  true,        
         loadPlugins: true,    
         userAgent: 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2729.4 Safari/537.36'
    }
});

var user = casper.cli.args[0],
	pwd = casper.cli.args[1];

casper.start().thenOpen('http://588ku.com/index.php?m=login&a=snsLogin&type=qq&source=',function(){});
casper.withFrame(0,function(){
	this.capture('1.png');
	this.echo('登录中...')
	this.click('#switcher_plogin');//切换
	this.wait(15000);
});
casper.withFrame(0,function(){
	this.capture('2.png');
	this.fillSelectors('form#loginform',{
		'#u' : user,
		'#p' : pwd
	});
	this.wait(15000);
});
casper.withFrame(0,function(){
	this.capture('3.png');
	this.click('form#loginform input[type="submit"]');
	this.wait(1000);
	this.capture('4.png');
	this.wait(15000);
});
casper.thenOpen(url,function(){
	this.echo('进入'+url);
	this.wait(15000);
	this.capture('5.png');
	this.waitForSelector('.already-sign-but');
});

casper.then(function(){
	this.echo('点击签到');
	this.click('a.already-sign-but');
	this.wait(12000);
});
casper.then(function(){
	if(this.exists('.signIn-btn')){
		this.echo('还未签到,正在签到中...')
	}
});
casper.then(function(){
	this.click('.signIn-btn');
	this.wait(11000);
});
casper.then(function(){
	this.capture('res.png');
	this.echo('签到结束,查看 res.png 图片');
});
casper.then(function(){
	this.exit();//退出
})

casper.run();

在来一张截图:

image.png

转载请注明出处: https://chrunlee.cn/article/auto-login-qianku.html


感谢支持!

赞赏支持
提交评论
评论信息 (请文明评论)
暂无评论,快来快来写想法...
推荐
互联网应用经常需要存储用户上传的图片,比如facebook相册。 facebook目前存储了2600亿张照片,总大小为20PB,每张照片约为80KB。用户每周新增照片数量为10亿。(总大小60TB),平均每秒新增3500张照片(3500次写请求),读操作峰值可以达到每秒百万次
对于开发来说,看到别人家的小程序都这么靓,这么顺畅,这么好用,用户又多... 自然是眼馋的..用户馋不来,可以先馋他的身子..啊不,代码啊。
跑了一个千库网的自动签到,在windows上测试的时候好好的,图片也没问题,可是放到linux服务器就不行了,总是登录不上不说,图片都不一样
发布自己的nodejs应用后,需要进行管理,目前一般都pm2来进行管理,这里记录下常用的命令。
前段时间做了个微信小程序反编译的小东西,不过因为功能不全,没加分包处理,正好处理下加上,又考虑到后续可能的更新情况,准备上手增加下更新功能。
获取文件夹内所有的文件。支持递归获取、异步或同步、过滤、返回信息处理。
想做微信/支付宝支付很久了..奈何需要的资质太多,只能慢慢申请,等待,审核..终于下来了。
前段时间帮朋友下歌放在车上听..结果好多都是ncm格式,伤心 ,搜索了下发现基本上这格式解密有好多昂,可惜UI我都不太想要..决定抄一下,自己做一个。 这里先记录下核心代码,回头补充个UI 做个小程序。