Greasy Fork

BT4G访问

绕过国内网络限制访问BT4G

目前为 2025-04-03 提交的版本。查看 最新版本

// ==UserScript==
// @name         BT4G访问
// @author       [email protected]
// @description  绕过国内网络限制访问BT4G
// @version      1.0.0.20250404
// @icon         data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAAAAAA6mKC9AAAAr0lEQVR4AU3OIQyDMBQE0D8vEHNIHHYO3WQGV6+m5hVekEzUizokDleBrqisboKqReB/bw0ZsJMvucsRrEpIjCMEXXYW6YJQ1X072VPoJZW2o17xI2pbOS7T38b7pha47QJTKRvM2QBtQvTRxwvwKXoTDfiEtX6K0cVDiGHKVm7zCmZOnAiMoa6EmyIyAYQsurg1fhh8HgsZkBC0LB9Nca9FR9gFiN7NLgI7gPm4wV+0DtHUd8v4dgAAAABJRU5ErkJggg==
// @match        *://bt4gprx.com/*
// @match        *://*.bt4g.com/*
// @match        *://bt4g.com/*
// @grant        GM_xmlhttpRequest
// @grant        GM_getValue
// @grant        GM_setValue
// @namespace    https://greasyfork.org/users/1453515
// @license      MIT

// ==/UserScript==

(function() {
    'use strict';

    // 检查当前域名是否属于 BT4G 相关站点
    const isBT4G = /^(.*\.)?bt4g(prx)?\.com$/.test(window.location.hostname);
    if (isBT4G) {
        const proxyUrl = 'https://api.allorigins.win/raw?url=' + encodeURIComponent(window.location.href);
        GM_xmlhttpRequest({
            method: 'GET',
            url: proxyUrl,
            onload: function(response) {
                document.open();
                document.write(response.responseText);
                document.close();
            },
            onerror: function(error) {
                console.error('BT4G访问代理失败:', error);
                alert('代理访问失败,请检查网络或更换代理服务!');
            }
        });
    }
})();