Created
January 12, 2014 17:18
-
-
Save BenjaminRH/8387624 to your computer and use it in GitHub Desktop.
This file contains 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== | |
// @id 987654321 | |
// @name Kickasstorrents | |
// @version 1.0 | |
// @namespace | |
// @author | |
// @description | |
// @run-at document-end | |
// @match http://*.kickass.to/* | |
// @match http://*.kat.ph/* | |
// ==/UserScript== | |
// parseUri 1.2.2 | |
// (c) Steven Levithan <stevenlevithan.com> | |
// MIT License | |
function parseUri (str) { | |
var o = parseUri.options, | |
m = o.parser[o.strictMode ? "strict" : "loose"].exec(str), | |
uri = {}, | |
i = 14; | |
while (i--) uri[o.key[i]] = m[i] || ""; | |
uri[o.q.name] = {}; | |
uri[o.key[12]].replace(o.q.parser, function ($0, $1, $2) { | |
if ($1) uri[o.q.name][$1] = $2; | |
}); | |
return uri; | |
}; | |
parseUri.options = { | |
strictMode: false, | |
key: ["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"], | |
q: { | |
name: "queryKey", | |
parser: /(?:^|&)([^&=]*)=?([^&]*)/g | |
}, | |
parser: { | |
strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/, | |
loose: /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/ | |
} | |
}; | |
var URL = document.URL; | |
var urlObj = parseUri(URL); | |
var domain = urlObj.host; | |
var proxy = "proxykat.eu"; | |
// var proxy = "katproxy.com"; | |
var URL = URL.replace(domain, proxy); | |
URL.replace(domain, proxy); | |
window.location = (URL); |
My First UserScript bro, and I learned something so your eyes are not bleeding in vain!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hilarious userscript designed to redirect kickass.to or kat.ph to a proxy for it (e.g. katproxy.com)