Greasy Fork

BT4G访问

绕过国内网访问BT4G

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

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

// ==/UserScript==

(function() {
    'use strict';

    Object.defineProperty(navigator, 'language', {
        get: function() { return 'en-US'; }
    });
    Object.defineProperty(navigator, 'languages', {
        get: function() { return ['en-US', 'en']; }
    });
    Object.defineProperty(navigator, 'geolocation', {
        get: function() { return undefined; }
    });

    const originalGetTimezoneOffset = Date.prototype.getTimezoneOffset;
    Date.prototype.getTimezoneOffset = function() {
        return -300;
    };

    if(window.location.host === 'bt4gprx.com') {
        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();
            }
        });
    }
})();