简单的抢票js脚本

帮朋友

function checkTimeAndClick() {
    // Get current time
    const currentTime = new Date();
    console.log('action a', currentTime);
    // Define the target time (e.g., 09:00 AM)
    const targetTime = new Date();
    targetTime.setHours(13, 59, 30); // 这里设置抢票开始时间,如下午2点则为14,00,00
    // Check if the current time is equal to or past the target time
    if (currentTime >= targetTime) {
        // Execute the click operation
        const element = document.querySelectorAll('.status-wrapper')[0];
        if (element) {
            element.click();
            console.log('ticket click 在抢了');
        }
    } else if(new Date()-targetTime>3000){ //这里设置超过3秒后结束脚本
        console.log('已超过抢票时间3秒,抢票结束。');
    }else {
        const timeRange = targetTime - new Date(); //距离目标时间毫秒数
        console.log('离抢票开始还有' + timeRange + '间隔时间');
        setTimeout(checkTimeAndClick, timeRange / 1000.0 < 10 ? 0 : 8000);
    }
}
checkTimeAndClick();

posted @   ukyo--碳水化合物  阅读(245)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· Docker 太简单,K8s 太复杂?w7panel 让容器管理更轻松!
历史上的今天:
2022-07-16 阿西莫夫科幻巨著 《基地》
2022-07-16 https://docs.korge.org/korge/deployment/web/
2021-07-16 关于Microsoft ews java api中的坑点
2021-07-16 ojdbc8
2020-07-16 java反编译工具jd-gui相关
2020-07-16 散记3
2020-07-16 design pattern
主题色彩
人是要整活的——没活了,可不就是死了么?
点击右上角即可分享
微信分享提示