// ==UserScript== // @name Google Unlocked // @version 1.6 // @namespace 45c9a6614fccd4edff9592da // @description Google Unlocked scans hidden search results that were censored by Google due to complaints // @home https://github.com/Ibit-to/google-unlocked // @supportURL https://github.com/Ibit-to/google-unlocked/issues // @updateURL https://raw.githubusercontent.com/Ibit-to/google-unlocked/master/google-unlocked.user.js // @downloadURL https://raw.githubusercontent.com/Ibit-to/google-unlocked/master/google-unlocked.user.js // @author Ibit - The Best Torrents // @license MIT License // @icon https://raw.githubusercontent.com/Ibit-to/google-unlocked/master/extension/32.png // @include *://www.google.*/* // @grant GM_xmlhttpRequest // @require http://code.jquery.com/jquery-3.4.1.min.js // @noframes // ==/UserScript== /* eslint-env browser, es6, greasemonkey, jquery */ $(function () { if (window.location.href.indexOf('//www.google') === -1) return; $('#search div.g').last().after(`

`) const s = $('#cc') const loadingElement = $('#cc_loading') const timeoutsElement = $('#cc_timeouts') const errorsElement = $('#cc_errors') let firstRun = true let totalFetchs = 0 $('div i > a').each((i, a) => { if (a.href === 'https://www.google.com/support/answer/1386831') return; totalFetchs++ // Give a loading feedback to user firstRun && loadingElement.prepend(`

Loading uncensored links...

`) firstRun = false return new Promise((resolve, reject) => { GM_xmlhttpRequest({ method: 'GET', url: a.href, timeout: 30000, // In milliseconds. If your connection is slow I'll suggest you to increase the time or just comment this line. onload: (response) => { if (response.status === 429) { console.error('ERROR 429 Too Many Requests') errorsElement.html('ERROR 429 Too Many Requests') reject() return; } let hm = {} const links = response.responseText.matchAll(/class="infringing_url">([^\s-<]+)\s*-\s*([0-9]+)/g) for (const i of links) { if (i[1] in hm) continue; hm[i[1]] = 1 let l = $('#l' + i[2]) if (l.length < 1) { s.prepend(`
`) l = $('#l' + i[2]) } l.append(`
${i[1]} (${i[2]} URLs)
`) } const divs = $('div[data-num]', s) divs.sort((a, b) => b.dataset.num - a.dataset.num) s.append(divs) resolve() }, onerror: (err) => { console.error('Request Error!\n', err.error) if(!$.trim(errorsElement.html())) errorsElement.append('Error on some requests'); reject() }, ontimeout: () => { console.warn(`[${i}] Request timeout`) if(!$.trim(timeoutsElement.html())) timeoutsElement.append('Request timeouts:'); timeoutsElement.append(' ' + i) reject() } }) }) // Cleanup .finally(() => { totalFetchs-- if (totalFetchs > 0) return; loadingElement.remove() }) // Promise error when rejected, ignore .catch(e => {}) }) })