Skip to content

Instantly share code, notes, and snippets.

@uyq
Created November 2, 2017 02:31
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save uyq/64e37c94151dc65ebbd86bafe1783520 to your computer and use it in GitHub Desktop.
Save uyq/64e37c94151dc65ebbd86bafe1783520 to your computer and use it in GitHub Desktop.
//刷帖子抢楼
var louceng = 256;
var postid = 400319;
var times = 0;
var timer1;
var isfast = false;
var isveryfast = false;
timer1 = window.setInterval(checkAndAutoReply, 30000);
var arr = [], lastid, nonce;
function checkAndAutoReply(){
times += 1;
$.get(
'/t/' + postid + '?t=' + Math.round(new Date().getTime()/1000),{},function(data,state){
arr = data.match(/="no">\d{3}<\/span>/g);
lastid = arr[arr.length-1].replace('="no">','').replace('</span>','');
var oncestr = data.match(/value="\d{5}" name="once"/g);
nonce = oncestr[0].replace('value="','').replace('" name="once"','');
if((louceng - lastid < 7) && isfast == false){
window.clearTimeout(timer1);
timer1 = window.setInterval(checkAndAutoReply, 5000);
}
if((louceng - lastid < 3) && isveryfast == false){
window.clearTimeout(timer1);
timer1 = window.setInterval(checkAndAutoReply, 1000);
}
//这里显示从服务器返回的数据
if(lastid > louceng-2 && lastid < louceng){
$.post(
"/t/" + postid,{
once: nonce,
content: '程序员当然爱好各种电子设备了,话说回来,iPhone X有人准备预约吗? 为防中奖还是需要留下邮箱 bagheera@qq.com',
},function(data,state){
console.log('抢楼成功!');
window.clearTimeout(timer1);
}
)
}else{
console.log(times + ':' + lastid);
}
}
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment