Spiegel hat jetzt ne Paywall

Da ich gerade folgendes bei Sempervideo sah: https://www.youtube.com/watch?v=UlLVCuk2i28 , baute ich kurz 1 kleines Javascript welches die Paywall umgeht 😀

Zu reinen Lernzwecken ist das Javascript sowie das Bookmarklet folgend zu sehen.

Bookmarklet:

javascript:void function(e){var t=function(e){function t(t){var n=[];return e(t).text().split("").forEach(function(e){n.push(32==e.charCodeAt(0)%3Fe:String.fromCharCode(e.charCodeAt(0)-1))}),n.join("").replace("°amp³","%26").replace("³"," %26")}var n=e(".obfuscated-content").html(),a='div:contains("SPIEGEL Plus")';jQuery(e(a)[e(a).length-12]).html(n),e(".obfuscated").each(function(){e(this).children().each(function(){e(this).is("a")||e(this).text(t(this))}),e(this).contents().filter(function(){return 3==this.nodeType}).each(function(){e(this).replaceWith(t(this))})}),e(".js-spiegelplus-obfuscated-intro").remove()},n=e%26%26e.fn%26%26parseFloat(e.fn.jquery)>=1.7;if(n)t(e);else{var a=document.createElement("script");a.src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.js",a.onload=a.onreadystatechange=function(){var e=this.readyState;e%26%26"loaded"!==e%26%26"complete"!==e||t(jQuery.noConflict())}}document.getElementsByTagName("head")[0].appendChild(a)}(window.jQuery);

Eigentlicher Code:

var content = $('.obfuscated-content').html();
var selector = 'div:contains("SPIEGEL Plus")';

jQuery($(selector)[$(selector).length - 12]).html(content);

function deobfuscate(dom) {
var newtext = [];

$(dom).text().split('').forEach(function(item) {
if (item.charCodeAt(0) == 32) {
newtext.push(item)
} else {
newtext.push(String.fromCharCode(item.charCodeAt(0) - 1))
}
});

return newtext.join('').replace("°amp³", "&").replace("³", " &");
}

$(".obfuscated").each(function() {
$(this).children().each(function() {
if (!$(this).is("a")) {
$(this).text(deobfuscate(this));
}
});

$(this).contents().filter(function() {
return this.nodeType == 3;
}).each(function() {
$(this).replaceWith(deobfuscate(this));
})
});

$('.js-spiegelplus-obfuscated-intro').remove();

Kommentar verfassen