Last active
April 4, 2022 16:04
-
-
Save noviluni/c1f4c48f3b5f4056af61a7b9be6c92ad to your computer and use it in GitHub Desktop.
Skip EliteTorrent URL redirect (https://2link.live/, https://short-info.link/, etc)
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
// Since some time ago EliteTorrent and other websites require to go through | |
// an annoying process for getting the links. This JS piece allows to skip it. | |
// You can automatically inject this with JSInjector or similar. | |
// Feel free to adapt it. | |
// (URL is usually base64 encoded several times and then encrypted with the Caesar Cipher) | |
if (window.location.href.indexOf("https://www.elitetorrent.nz") != -1) { | |
var link = document.getElementsByClassName('enlace_torrent')[0].href; | |
var url_encoded = link.slice(link.indexOf('?i=') + 3); | |
var url = atob(atob(atob(atob(atob(url_encoded))))); | |
decrypt_url(url); | |
}; | |
function decrypt_url(original_url) { | |
var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; | |
var shift = 13; | |
var result_url = ''; | |
for (var i = 0; i < original_url.length; i++) { | |
var character = original_url[i]; | |
var isLower = character != character.toUpperCase(); | |
var position = chars.indexOf(character.toUpperCase()); | |
if (position != -1) { | |
var new_chars = chars.slice(position) + chars.slice(0, position); | |
var character = new_chars[shift]; | |
if (isLower) { | |
var character = character.toLowerCase(); | |
}; | |
}; | |
result_url += character; | |
}; | |
alert(result_url) | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment