js 脚本 各种网站定点 秒杀 抢购商品

通常在 购物网站 会遇到各种抢购 商品,奈何手速跟不上,这就需要自己写个脚本 来试试啦!!

原理:不管是抢购什么商品,都是一个原理 我们快速的点击下单按钮或者确认按钮来跳到支付页面,进行结算,所以有时候我们明明看着时间差不多点的 或者 到点 秒点击 还是会发现抢不到,所以这个是时候就可以试一下脚本。

1. 首先 需要来一个倒计时确认的方法 来保证和网站时间同步。

function CurentTime()
        {
          var now = new Date();
          var year = now.getFullYear(); //年
          var month = now.getMonth() + 1; //月
          var day = now.getDate(); //日
          var hh = now.getHours(); //时
          var mm = now.getMinutes(); //分
          var ss =now.getSeconds() //秒
           clock = year + "-";
          if(month < 10)
              clock += "0";
              clock += month + "-";           
          if(day < 10)
            clock += "0";
            clock += day + " ";  
          
          if(hh < 10)
             clock += "0";
             clock += hh +":"; 
          
          if (mm < 10)
              clock += '0';
              clock += mm+":";
          
          if (ss < 10)
              clock += '0';
              clock += ss;
           
          //return(clock);
          console.log(clock)
      } 

2. 好了有了这个方法就可以确保时间是同步的了,接下来获取元素,写个定时器直接请求就ok了。

 var btnObj =$('.product-button02') //举例 根据自己实际情况填写
      console.log(btnObj)
      var timer=setInterval(function(){
           CurentTime()
           if (clock=='2021-08-09 16:00:50') { // 当按钮可以点击时
                    btnObj.click();		//点击
                  //  clearInterval(timer); // 选购完成后关闭timer,否则将一直购买,土豪随意
                }else{
                  console.log('4444')
                }
      },1000)

3. 脚本写好以后,直接打开网站console(按f12可直接进入)直接回车运行就好了。

  • 7
    点赞
  • 57
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值