Skip to content

Instantly share code, notes, and snippets.

@Auax
Last active July 5, 2023 12:38

Revisions

  1. Auax revised this gist Jul 5, 2023. 1 changed file with 50 additions and 33 deletions.
    83 changes: 50 additions & 33 deletions thepiratebay_bypass_block.js
    Original file line number Diff line number Diff line change
    @@ -2,49 +2,66 @@
    // @name ThePirateBay-Block-Redirect
    // @namespace http://tampermonkey.net/
    // @version 0.1
    // @description Bypass imposed blocks to thepiratebay.org website by redirecting you to a CroxyProxy url.
    // @description If The Pirate Bay is blocked in your country, launch a croxyproxy instance and bypass it!
    // @author Auax
    // @match https://thepiratebay.org/
    // @icon https://www.google.com/s2/favicons?sz=64&domain=thepiratebay.org
    // @grant GM_xmlhttpRequest
    // ==/UserScript==



    (function () {
    'use strict';

    if (!window.onload) {
    // Make a request to load the website
    GM_xmlhttpRequest({
    method: 'POST',
    url: 'https://www.croxyproxy.com/requests?fso=',
    headers: {
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/114.0',
    'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8',
    'Accept-Language': 'en-US,en;q=0.5',
    'Content-Type': 'application/x-www-form-urlencoded',
    'Upgrade-Insecure-Requests': '1',
    'Sec-Fetch-Dest': 'document',
    'Sec-Fetch-Mode': 'navigate',
    'Sec-Fetch-Site': 'same-origin',
    'Sec-GPC': '1'
    },
    referrer: 'https://www.croxyproxy.com/servers',
    data: 'url=thepiratebay.org&proxyServerId=154&demo=0&frontOrigin=https%3A%2F%2Fwww.croxyproxy.com',
    onload: function (response) {
    // Handle the response here
    console.log(response);
    const reURL = response.finalUrl;
    console.log(reURL);
    if (reURL.trim().length !== 0) {
    window.location.href = reURL;
    let repeatRequest = true;
    let repeatCount = 0;
    const maxAttempts = 10;

    function makeRequest() {
    // Try random server ID
    const serverID = Math.floor(Math.random() * 41) + 100;

    GM_xmlhttpRequest({
    method: 'POST',
    url: 'https://www.croxyproxy.com/requests?fso=',
    headers: {
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/114.0',
    'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8',
    'Accept-Language': 'en-US,en;q=0.5',
    'Content-Type': 'application/x-www-form-urlencoded',
    'Upgrade-Insecure-Requests': '1',
    'Sec-Fetch-Dest': 'document',
    'Sec-Fetch-Mode': 'navigate',
    'Sec-Fetch-Site': 'same-origin',
    'Sec-GPC': '1'
    },
    referrer: 'https://www.croxyproxy.com/servers',
    data: `url=thepiratebay.org&proxyServerId=${serverID}&demo=0&frontOrigin=https%3A%2F%2Fwww.croxyproxy.com`,
    onload: function (response) {
    if (response.status !== 500) {
    repeatRequest = false;
    const reURL = response.finalUrl;
    if (reURL.trim().length !== 0) {
    window.location.href = reURL;
    }
    }
    repeatCount++;
    console.warn(`Server ID ${serverID} didn't work! Retrying...`);
    if (repeatRequest && repeatCount < maxAttempts) {
    setTimeout(makeRequest, 1000);
    }
    },
    onerror: function (error) {
    console.error(error);
    repeatCount++;
    console.error(`Request failed for Server ID ${serverID}! Retrying...`);
    if (repeatRequest && repeatCount < maxAttempts) {
    setTimeout(makeRequest, 1000);
    }
    }
    });
    }

    },
    onerror: function(error) {
    // Handle any errors here
    console.error(error);
    }
    });
    makeRequest();
    }
    })();
  2. Auax revised this gist Jul 3, 2023. 1 changed file with 0 additions and 2 deletions.
    2 changes: 0 additions & 2 deletions thepiratebay_bypass_block.js
    Original file line number Diff line number Diff line change
    @@ -46,7 +46,5 @@
    console.error(error);
    }
    });


    }
    })();
  3. Auax revised this gist Jul 3, 2023. 1 changed file with 0 additions and 2 deletions.
    2 changes: 0 additions & 2 deletions thepiratebay_bypass_block.js
    Original file line number Diff line number Diff line change
    @@ -14,8 +14,6 @@
    (function () {
    'use strict';
    if (!window.onload) {
    // Define the URL you want to load

    // Make a request to load the website
    GM_xmlhttpRequest({
    method: 'POST',
  4. Auax revised this gist Jul 3, 2023. No changes.
  5. Auax revised this gist Jul 3, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion thepiratebay_bypass_block.js
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@
    // @name ThePirateBay-Block-Redirect
    // @namespace http://tampermonkey.net/
    // @version 0.1
    // @description If thepiratebay is blocked in your country, launch a croxyproxy instance and bypass this!
    // @description Bypass imposed blocks to thepiratebay.org website by redirecting you to a CroxyProxy url.
    // @author Auax
    // @match https://thepiratebay.org/
    // @icon https://www.google.com/s2/favicons?sz=64&domain=thepiratebay.org
  6. Auax created this gist Jul 3, 2023.
    54 changes: 54 additions & 0 deletions thepiratebay_bypass_block.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,54 @@
    // ==UserScript==
    // @name ThePirateBay-Block-Redirect
    // @namespace http://tampermonkey.net/
    // @version 0.1
    // @description If thepiratebay is blocked in your country, launch a croxyproxy instance and bypass this!
    // @author Auax
    // @match https://thepiratebay.org/
    // @icon https://www.google.com/s2/favicons?sz=64&domain=thepiratebay.org
    // @grant GM_xmlhttpRequest
    // ==/UserScript==



    (function () {
    'use strict';
    if (!window.onload) {
    // Define the URL you want to load

    // Make a request to load the website
    GM_xmlhttpRequest({
    method: 'POST',
    url: 'https://www.croxyproxy.com/requests?fso=',
    headers: {
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/114.0',
    'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8',
    'Accept-Language': 'en-US,en;q=0.5',
    'Content-Type': 'application/x-www-form-urlencoded',
    'Upgrade-Insecure-Requests': '1',
    'Sec-Fetch-Dest': 'document',
    'Sec-Fetch-Mode': 'navigate',
    'Sec-Fetch-Site': 'same-origin',
    'Sec-GPC': '1'
    },
    referrer: 'https://www.croxyproxy.com/servers',
    data: 'url=thepiratebay.org&proxyServerId=154&demo=0&frontOrigin=https%3A%2F%2Fwww.croxyproxy.com',
    onload: function (response) {
    // Handle the response here
    console.log(response);
    const reURL = response.finalUrl;
    console.log(reURL);
    if (reURL.trim().length !== 0) {
    window.location.href = reURL;
    }

    },
    onerror: function(error) {
    // Handle any errors here
    console.error(error);
    }
    });


    }
    })();