Last active
February 22, 2022 06:47
-
-
Save trent2/4f1198a173019103478cbefbcaf4c744 to your computer and use it in GitHub Desktop.
Unobfuscate SPIEGEL plus articles with greasemonkey
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== | |
// @name unobfuscate spiegel plus | |
// @namespace obfuscate | |
// @include http://www.spiegel.de/* | |
// @version 1 | |
// @grant none | |
// ==/UserScript== | |
if(document.getElementsByClassName('obfuscated-content')[0] != undefined) { | |
document.getElementsByClassName('obfuscated-content')[0].setAttribute("class", ""); | |
var elems = document.getElementsByClassName('obfuscated'), t, or, c, i, cc; | |
for(i in elems) { | |
or = elems[i].innerHTML; | |
t = ""; | |
inElement = false; | |
openTag = -1; | |
isATag = false; | |
closingTag = false; | |
dontTranslate = false; | |
if(or != undefined) | |
for(c=0; c<or.length; ++c) { | |
if(openTag>-1) | |
openTag++; | |
cc = or.charCodeAt(c); | |
if(cc == 60) { // "<" | |
dontTranslate = true; | |
inElement = true; | |
openTag = 0; | |
} | |
if(cc>33 && !dontTranslate) { | |
switch(cc) { | |
case 180: t += ";"; break; | |
case 178: t += "!"; break; | |
case 177: t += "&"; break; | |
default: | |
t += String.fromCharCode(cc-1); | |
} | |
} | |
else | |
t += or.charAt(c); | |
if(openTag==1 && cc == 97) // <a ... | |
isATag = true; | |
if(openTag==1 && cc == 47) // "</" | |
closingTag = true; | |
if(inElement && cc == 62) { // "<...>" | |
dontTranslate = isATag && !closingTag; | |
isATag = false; | |
inElement = closingTag = false; | |
openTag = -1; | |
} | |
} | |
elems[i].innerHTML = t; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What kind of option?
About four years ago, Spiegel online changed the way Spiegel plus pages are displayed. Before, they send all content of the articel to the user, pretty lamely encrypted (rather obfuscated) for those not logged in, very easily to decypher.
From then on 95% of the article's text is not send to the web client at all if you're not logged in as a paying user, not even obfuscated or encrypted. This (old) script is purely running on your client, i.e. probably your web browser. You cannot decrypt anything from nothing.