Last active
July 5, 2023 12:38
-
-
Save Auax/2aa8b64ba5aad0c8b2089238d29b0cec to your computer and use it in GitHub Desktop.
Userscript to automatically bypass imposed blocks to thepiratebay.org website by redirecting you to a CroxyProxy url. Use tampermonkey or greasemonkey to add this userscript!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name ThePirateBay-Block-Redirect | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @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) { | |
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); | |
} | |
} | |
}); | |
} | |
makeRequest(); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment