cpp抢票脚本

代抢

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         cpp抢票脚本
// @namespace    http://tampermonkey.net/
// @version      2024-2-1
// @description  代抢
// @author       3432276416
// @match        https://cp.allcpp.cn/*
// @icon         https://img01.yzcdn.cn/v2/image/yz_fc.ico
// @grant        GM_setValue
// @grant        GM_getValue
// @license      MIT
// ==/UserScript==

(async function() {
    await new Promise(resolve => setTimeout(resolve, 1000));

    let item = document.querySelectorAll('.ticket-box');
    for (let i = 0; i < item.length; i++) {
        if (item[i].innerText.includes('双日')) {
            item[i].click();
        }
    }


    let btn = document.querySelectorAll('button');
    for (let i = 0; i < btn.length; i++) {
        if (btn[i].innerText.includes('购票')) {

            btn[i].click();
        }
    }
    await new Promise(resolve => setTimeout(resolve, 1000));
    let info = document.querySelectorAll('.sc-hjsNop.gQcqhw.purchaser-item')[0];
    if (info != null) {
        info.click();
    }
    let paybtn = document.querySelectorAll('button');
    for (let i = 0; i < paybtn.length; i++) {
        if (paybtn[i].innerText.includes('付款')) {
            paybtn[i].click();
        }
    }
    await new Promise(resolve => setTimeout(resolve, 1000));
    location.reload(true);
})();