海运的博客

使用Tampermonkey油猴脚本自动抢购斯巴达spartanhost vps

发布时间:March 1, 2021 // 分类: // 3 Comments

最近斯巴达vps比较火,一机难求,写了个js脚本用于抢购,效果还不错,推荐使用chrome浏览器,安装Tampermonkey扩展使用。

// ==UserScript==
// @name         自动抢购买vps
// @namespace    https://www.haiyun.me
// @version      0.1
// @description  buy spartanhost vps
// @author       www.haiyun.me
// @match        https://billing.spartanhost.net/cart.php?a=*
// @grant        none
// ==/UserScript==

(function() {
    var forcedReload = false;
    var time = 500; 
    var url = document.URL;
    var hostname = "www.haiyun.me";
    var customfield = "website";
    if (document.title == '502 Bad Gateway') {
        setTimeout(function() {
            window.location.reload(forcedReload);
        }, time);
    } else if (document.title == '504 Gateway Time-out') {
        setTimeout(function() {
            window.location.reload(forcedReload);
        }, time);
    } else if (document.title == '503 Service Temporarily Unavailable') {
        setTimeout(function() {
            window.location.reload(forcedReload);
        }, time);
    } else if (document.title == '500 Internal Server Error') {
        setTimeout(function() {
            window.location.reload(forcedReload);
        }, time);
    } else if (document.getElementsByTagName('h1')[0].innerHTML == '无法访问此网站') {
        setTimeout(function() {
            window.location.reload(forcedReload);
        }, time);
    }

    if (url.indexOf("https://billing.spartanhost.net/cart.php?a=add") != -1) {
        var str = document.getElementById("order-boxes").innerHTML;
        if (str.indexOf("Out of Stock") != -1) {
            setTimeout(function() {
                window.location.reload(forcedReload);
            }, time);
        }
    } else if (url.indexOf("https://billing.spartanhost.net/cart.php?a=confproduct") != -1) {
        document.getElementById("inputHostname").value = hostname;
        var element = document.querySelector('input[name^="customfield"]');
        element.value = customfield;
        document.getElementById("btnCompleteProductConfig").click();
    } else if (url.indexOf("https://billing.spartanhost.net/cart.php?a=view") != -1) {
        document.getElementById("checkout").click();
    } else if (url.indexOf("https://billing.spartanhost.net/cart.php?a=checkout") != -1) {
        document.getElementById("iCheck-accepttos").click();
        document.getElementById("btnCompleteOrder").click();
    }
})();

标签:vps, tampermonkey

有 3 条 关于" 使用Tampermonkey油猴脚本自动抢购斯巴达spartanhost vps "的评论

  1. spartan

    大佬斯巴达开启了CF的机器识别验证,请问插件能自动跳过吗?
    另外这个脚本有没有简单使用说明,新手请见谅,不懂就问了

    1. 海运

      应该能,在购买页面先手工跳过cf机器验证,后续一定时间内不更换ip应该不会再次验证。

  2. spartan2

    https://dashboard.hcaptcha.com/welcome_accessibility
    这个可以12小时内跳过验证
    建议博主写个自动设置cookie的

评论已关闭

分类
最新文章
最近回复
  • opnfense: 谢谢博主!!!解决问题了!!!我之前一直以为内置的odhcp6就是唯一管理ipv6的方式
  • liyk: 这个方法获取的IPv6大概20分钟之后就会失效,默认路由先消失,然后Global IPV6再消失
  • 海运: 不好意思,没有。
  • zongboa: 您好,請問一下有immortalwrt設定guest Wi-Fi的GUI教學嗎?感謝您。
  • 海运: 恩山有很多。
  • swsend: 大佬可以分享一下固件吗,谢谢。
  • Jimmy: 方法一 nghtp3步骤需要改成如下才能编译成功: git clone https://git...
  • 海运: 地址格式和udpxy一样,udpxy和msd_lite能用这个就能用。
  • 1: 怎么用 编译后的程序在家里路由器内任意一台设备上运行就可以吗?比如笔记本电脑 m参数是笔记本的...
  • 孤狼: ups_status_set: seems that UPS [BK650M2-CH] is ...