Bypass Google Sorry (reCAPTCHA) / Fix

Redirect Google reCAPTCHA to new search

// ==UserScript==
// @name         Bypass Google Sorry (reCAPTCHA) / Fix
// @version      0.7.2
// @description  Redirect Google reCAPTCHA to new search
// @author       Ang Li / Beridok
// @namespace    beridok@gmail.com
// @license      MIT
// @match        https://www.google.com/sorry/*
// @match        https://www.google.ad/sorry/*
// @match        https://www.google.ae/sorry/*
// @match        https://www.google.com.af/sorry/*
// @match        https://www.google.com.ag/sorry/*
// @match        https://www.google.com.ai/sorry/*
// @match        https://www.google.al/sorry/*
// @match        https://www.google.am/sorry/*
// @match        https://www.google.co.ao/sorry/*
// @match        https://www.google.com.ar/sorry/*
// @match        https://www.google.as/sorry/*
// @match        https://www.google.at/sorry/*
// @match        https://www.google.com.au/sorry/*
// @match        https://www.google.az/sorry/*
// @match        https://www.google.ba/sorry/*
// @match        https://www.google.com.bd/sorry/*
// @match        https://www.google.be/sorry/*
// @match        https://www.google.bf/sorry/*
// @match        https://www.google.bg/sorry/*
// @match        https://www.google.com.bh/sorry/*
// @match        https://www.google.bi/sorry/*
// @match        https://www.google.bj/sorry/*
// @match        https://www.google.com.bn/sorry/*
// @match        https://www.google.com.bo/sorry/*
// @match        https://www.google.com.br/sorry/*
// @match        https://www.google.bs/sorry/*
// @match        https://www.google.bt/sorry/*
// @match        https://www.google.co.bw/sorry/*
// @match        https://www.google.by/sorry/*
// @match        https://www.google.com.bz/sorry/*
// @match        https://www.google.ca/sorry/*
// @match        https://www.google.cd/sorry/*
// @match        https://www.google.cf/sorry/*
// @match        https://www.google.cg/sorry/*
// @match        https://www.google.ch/sorry/*
// @match        https://www.google.ci/sorry/*
// @match        https://www.google.co.ck/sorry/*
// @match        https://www.google.cl/sorry/*
// @match        https://www.google.cm/sorry/*
// @match        https://www.google.cn/sorry/*
// @match        https://www.google.com.co/sorry/*
// @match        https://www.google.co.cr/sorry/*
// @match        https://www.google.com.cu/sorry/*
// @match        https://www.google.cv/sorry/*
// @match        https://www.google.com.cy/sorry/*
// @match        https://www.google.cz/sorry/*
// @match        https://www.google.de/sorry/*
// @match        https://www.google.dj/sorry/*
// @match        https://www.google.dk/sorry/*
// @match        https://www.google.dm/sorry/*
// @match        https://www.google.com.do/sorry/*
// @match        https://www.google.dz/sorry/*
// @match        https://www.google.com.ec/sorry/*
// @match        https://www.google.ee/sorry/*
// @match        https://www.google.com.eg/sorry/*
// @match        https://www.google.es/sorry/*
// @match        https://www.google.com.et/sorry/*
// @match        https://www.google.fi/sorry/*
// @match        https://www.google.com.fj/sorry/*
// @match        https://www.google.fm/sorry/*
// @match        https://www.google.fr/sorry/*
// @match        https://www.google.ga/sorry/*
// @match        https://www.google.ge/sorry/*
// @match        https://www.google.gg/sorry/*
// @match        https://www.google.com.gh/sorry/*
// @match        https://www.google.com.gi/sorry/*
// @match        https://www.google.gl/sorry/*
// @match        https://www.google.gm/sorry/*
// @match        https://www.google.gr/sorry/*
// @match        https://www.google.com.gt/sorry/*
// @match        https://www.google.gy/sorry/*
// @match        https://www.google.com.hk/sorry/*
// @match        https://www.google.hn/sorry/*
// @match        https://www.google.hr/sorry/*
// @match        https://www.google.ht/sorry/*
// @match        https://www.google.hu/sorry/*
// @match        https://www.google.co.id/sorry/*
// @match        https://www.google.ie/sorry/*
// @match        https://www.google.co.il/sorry/*
// @match        https://www.google.im/sorry/*
// @match        https://www.google.co.in/sorry/*
// @match        https://www.google.iq/sorry/*
// @match        https://www.google.is/sorry/*
// @match        https://www.google.it/sorry/*
// @match        https://www.google.je/sorry/*
// @match        https://www.google.com.jm/sorry/*
// @match        https://www.google.jo/sorry/*
// @match        https://www.google.co.jp/sorry/*
// @match        https://www.google.co.ke/sorry/*
// @match        https://www.google.com.kh/sorry/*
// @match        https://www.google.ki/sorry/*
// @match        https://www.google.kg/sorry/*
// @match        https://www.google.co.kr/sorry/*
// @match        https://www.google.com.kw/sorry/*
// @match        https://www.google.kz/sorry/*
// @match        https://www.google.la/sorry/*
// @match        https://www.google.com.lb/sorry/*
// @match        https://www.google.li/sorry/*
// @match        https://www.google.lk/sorry/*
// @match        https://www.google.co.ls/sorry/*
// @match        https://www.google.lt/sorry/*
// @match        https://www.google.lu/sorry/*
// @match        https://www.google.lv/sorry/*
// @match        https://www.google.com.ly/sorry/*
// @match        https://www.google.co.ma/sorry/*
// @match        https://www.google.md/sorry/*
// @match        https://www.google.me/sorry/*
// @match        https://www.google.mg/sorry/*
// @match        https://www.google.mk/sorry/*
// @match        https://www.google.ml/sorry/*
// @match        https://www.google.com.mm/sorry/*
// @match        https://www.google.mn/sorry/*
// @match        https://www.google.ms/sorry/*
// @match        https://www.google.com.mt/sorry/*
// @match        https://www.google.mu/sorry/*
// @match        https://www.google.mv/sorry/*
// @match        https://www.google.mw/sorry/*
// @match        https://www.google.com.mx/sorry/*
// @match        https://www.google.com.my/sorry/*
// @match        https://www.google.co.mz/sorry/*
// @match        https://www.google.com.na/sorry/*
// @match        https://www.google.com.ng/sorry/*
// @match        https://www.google.com.ni/sorry/*
// @match        https://www.google.ne/sorry/*
// @match        https://www.google.nl/sorry/*
// @match        https://www.google.no/sorry/*
// @match        https://www.google.com.np/sorry/*
// @match        https://www.google.nr/sorry/*
// @match        https://www.google.nu/sorry/*
// @match        https://www.google.co.nz/sorry/*
// @match        https://www.google.com.om/sorry/*
// @match        https://www.google.com.pa/sorry/*
// @match        https://www.google.com.pe/sorry/*
// @match        https://www.google.com.pg/sorry/*
// @match        https://www.google.com.ph/sorry/*
// @match        https://www.google.com.pk/sorry/*
// @match        https://www.google.pl/sorry/*
// @match        https://www.google.pn/sorry/*
// @match        https://www.google.com.pr/sorry/*
// @match        https://www.google.ps/sorry/*
// @match        https://www.google.pt/sorry/*
// @match        https://www.google.com.py/sorry/*
// @match        https://www.google.com.qa/sorry/*
// @match        https://www.google.ro/sorry/*
// @match        https://www.google.ru/sorry/*
// @match        https://www.google.rw/sorry/*
// @match        https://www.google.com.sa/sorry/*
// @match        https://www.google.com.sb/sorry/*
// @match        https://www.google.sc/sorry/*
// @match        https://www.google.se/sorry/*
// @match        https://www.google.com.sg/sorry/*
// @match        https://www.google.sh/sorry/*
// @match        https://www.google.si/sorry/*
// @match        https://www.google.sk/sorry/*
// @match        https://www.google.com.sl/sorry/*
// @match        https://www.google.sn/sorry/*
// @match        https://www.google.so/sorry/*
// @match        https://www.google.sm/sorry/*
// @match        https://www.google.sr/sorry/*
// @match        https://www.google.st/sorry/*
// @match        https://www.google.com.sv/sorry/*
// @match        https://www.google.td/sorry/*
// @match        https://www.google.tg/sorry/*
// @match        https://www.google.co.th/sorry/*
// @match        https://www.google.com.tj/sorry/*
// @match        https://www.google.tl/sorry/*
// @match        https://www.google.tm/sorry/*
// @match        https://www.google.tn/sorry/*
// @match        https://www.google.to/sorry/*
// @match        https://www.google.com.tr/sorry/*
// @match        https://www.google.tt/sorry/*
// @match        https://www.google.com.tw/sorry/*
// @match        https://www.google.co.tz/sorry/*
// @match        https://www.google.com.ua/sorry/*
// @match        https://www.google.co.ug/sorry/*
// @match        https://www.google.co.uk/sorry/*
// @match        https://www.google.com.uy/sorry/*
// @match        https://www.google.co.uz/sorry/*
// @match        https://www.google.com.vc/sorry/*
// @match        https://www.google.co.ve/sorry/*
// @match        https://www.google.vg/sorry/*
// @match        https://www.google.co.vi/sorry/*
// @match        https://www.google.com.vn/sorry/*
// @match        https://www.google.vu/sorry/*
// @match        https://www.google.ws/sorry/*
// @match        https://www.google.rs/sorry/*
// @match        https://www.google.co.za/sorry/*
// @match        https://www.google.co.zm/sorry/*
// @match        https://www.google.co.zw/sorry/*
// @match        https://www.google.cat/sorry/*
// @grant        none
// @run-at       document-start
// ==/UserScript==

var immediatelyReplace = false; //If false, use delayed attempts...
var delay = 1500;
//var delay = 2*60*1000;

console.info('%c «%s» %c—— %c %s ',
             'background:#000000; color:#7ebe45', GM_info.script.name,
             'background:#000000; color:dimgray',
             'background:#3c424d; color:#ffffff', GM_info.script.version);

function getParameterByName(name, url) {
    if (!url) url = window.location.href;
    name = name.replace(/[\[\]]/g, "\\$&");
    var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
        results = regex.exec(url);
    if (!results) return null;
    if (!results[2]) return '';
    return decodeURIComponent(results[2].replace(/\+/g, " "));
}

function getURLfromErrorText(){
    var fullURLText = document.querySelector('body > div:nth-child(1) > div:nth-child(5)').children[10].previousSibling.textContent;
    fullURLText = fullURLText.split("Adres URL: ")[1].split("&sec_act")[0]
    return fullURLText
}

function getRandomGoogleURL() {
    var newURL;
    var n = Math.floor(Math.random()*listOfGoogleDomains.length);
    newURL = "https://www"+listOfGoogleDomains[n]+"/search?q=";
    return newURL;
}

(function() {
    'use strict';
    var googleSorryUrl = decodeURIComponent(window.location.href);
    var targetDomain = getParameterByName('continue', googleSorryUrl);
    //if(targetDomain.match("google")){
    if(targetDomain.match("google")){
        if ( immediatelyReplace === true ) {
            window.location.replace(getRandomGoogleURL() + getParameterByName('q', googleSorryUrl));
        }
        else {
            setTimeout(() => {
                //var newURL = decodeURIComponent(window.location.href).split('continue=')[1];
                //window.location = newURL;
                window.location.replace(getRandomGoogleURL() + getParameterByName('q', googleSorryUrl));
            }, delay)
        }
    }
    else {
        if ( immediatelyReplace === true ) {
            var newURL = decodeURIComponent(window.location.href).split('continue=')[1];
                window.location = newURL;
        }
        else {
            setTimeout(() => {
                var newURL = decodeURIComponent(window.location.href).split('continue=')[1];
                window.location = newURL;
            }, delay)
        }
    }
})();

var listOfGoogleDomains = [".google.com",
                           ".google.ad",
                           ".google.ae",
                           ".google.com.af",
                           ".google.com.ag",
                           ".google.com.ai",
                           ".google.al",
                           ".google.am",
                           ".google.co.ao",
                           ".google.com.ar",
                           ".google.as",
                           ".google.at",
                           ".google.com.au",
                           ".google.az",
                           ".google.ba",
                           ".google.com.bd",
                           ".google.be",
                           ".google.bf",
                           ".google.bg",
                           ".google.com.bh",
                           ".google.bi",
                           ".google.bj",
                           ".google.com.bn",
                           ".google.com.bo",
                           ".google.com.br",
                           ".google.bs",
                           ".google.bt",
                           ".google.co.bw",
                           ".google.by",
                           ".google.com.bz",
                           ".google.ca",
                           ".google.cd",
                           ".google.cf",
                           ".google.cg",
                           ".google.ch",
                           ".google.ci",
                           ".google.co.ck",
                           ".google.cl",
                           ".google.cm",
                           ".google.cn",
                           ".google.com.co",
                           ".google.co.cr",
                           ".google.com.cu",
                           ".google.cv",
                           ".google.com.cy",
                           ".google.cz",
                           ".google.de",
                           ".google.dj",
                           ".google.dk",
                           ".google.dm",
                           ".google.com.do",
                           ".google.dz",
                           ".google.com.ec",
                           ".google.ee",
                           ".google.com.eg",
                           ".google.es",
                           ".google.com.et",
                           ".google.fi",
                           ".google.com.fj",
                           ".google.fm",
                           ".google.fr",
                           ".google.ga",
                           ".google.ge",
                           ".google.gg",
                           ".google.com.gh",
                           ".google.com.gi",
                           ".google.gl",
                           ".google.gm",
                           ".google.gr",
                           ".google.com.gt",
                           ".google.gy",
                           ".google.com.hk",
                           ".google.hn",
                           ".google.hr",
                           ".google.ht",
                           ".google.hu",
                           ".google.co.id",
                           ".google.ie",
                           ".google.co.il",
                           ".google.im",
                           ".google.co.in",
                           ".google.iq",
                           ".google.is",
                           ".google.it",
                           ".google.je",
                           ".google.com.jm",
                           ".google.jo",
                           ".google.co.jp",
                           ".google.co.ke",
                           ".google.com.kh",
                           ".google.ki",
                           ".google.kg",
                           ".google.co.kr",
                           ".google.com.kw",
                           ".google.kz",
                           ".google.la",
                           ".google.com.lb",
                           ".google.li",
                           ".google.lk",
                           ".google.co.ls",
                           ".google.lt",
                           ".google.lu",
                           ".google.lv",
                           ".google.com.ly",
                           ".google.co.ma",
                           ".google.md",
                           ".google.me",
                           ".google.mg",
                           ".google.mk",
                           ".google.ml",
                           ".google.com.mm",
                           ".google.mn",
                           ".google.ms",
                           ".google.com.mt",
                           ".google.mu",
                           ".google.mv",
                           ".google.mw",
                           ".google.com.mx",
                           ".google.com.my",
                           ".google.co.mz",
                           ".google.com.na",
                           ".google.com.ng",
                           ".google.com.ni",
                           ".google.ne",
                           ".google.nl",
                           ".google.no",
                           ".google.com.np",
                           ".google.nr",
                           ".google.nu",
                           ".google.co.nz",
                           ".google.com.om",
                           ".google.com.pa",
                           ".google.com.pe",
                           ".google.com.pg",
                           ".google.com.ph",
                           ".google.com.pk",
                           ".google.pl",
                           ".google.pn",
                           ".google.com.pr",
                           ".google.ps",
                           ".google.pt",
                           ".google.com.py",
                           ".google.com.qa",
                           ".google.ro",
                           ".google.ru",
                           ".google.rw",
                           ".google.com.sa",
                           ".google.com.sb",
                           ".google.sc",
                           ".google.se",
                           ".google.com.sg",
                           ".google.sh",
                           ".google.si",
                           ".google.sk",
                           ".google.com.sl",
                           ".google.sn",
                           ".google.so",
                           ".google.sm",
                           ".google.sr",
                           ".google.st",
                           ".google.com.sv",
                           ".google.td",
                           ".google.tg",
                           ".google.co.th",
                           ".google.com.tj",
                           ".google.tl",
                           ".google.tm",
                           ".google.tn",
                           ".google.to",
                           ".google.com.tr",
                           ".google.tt",
                           ".google.com.tw",
                           ".google.co.tz",
                           ".google.com.ua",
                           ".google.co.ug",
                           ".google.co.uk",
                           ".google.com.uy",
                           ".google.co.uz",
                           ".google.com.vc",
                           ".google.co.ve",
                           ".google.vg",
                           ".google.co.vi",
                           ".google.com.vn",
                           ".google.vu",
                           ".google.ws",
                           ".google.rs",
                           ".google.co.za",
                           ".google.co.zm",
                           ".google.co.zw",
                           ".google.cat"
                          ]