Greasy Fork

KN Paywall Killer

A script that removes paywall from Kieler Nachrichten (KN+) and Ostsee-Zeitung (OZ+) articles by copying the article text from a script element in the source code into the body.

目前为 2022-11-16 提交的版本。查看 最新版本

// ==UserScript==
// @name KN Paywall Killer
// @description A script that removes paywall from Kieler Nachrichten (KN+) and Ostsee-Zeitung (OZ+) articles by copying the article text from a script element in the source code into the body.
// @description:de Ein Skript, das die Paywall in Artikeln der Kieler Nachrichten (KN+) und Ostsee-Zeitung (OZ+) entfernt, indem es den Artikeltext aus einem Skript im Quelltext in den Body kopiert
// @include https://www.kn-online.de/*
// @include https://www.ostsee-zeitung.de/*
// @namespace Discostu36/KN-Paywall-Killer
// @run-at document-idle
// @version 1.3
// @license MIT
// ==/UserScript==


var paywall = document.querySelector(".paywall");
var paywall2 = document.querySelector('[id^="piano-lightbox-article-"]');
var contentScript = document.querySelectorAll("script[type='application/ld+json']")[2]; 
var contentObject = JSON.parse(contentScript.text);
var articleBody = contentObject.articleBody.replace(" Lesen Sie auch", ""); 
var descriptionP = document.querySelector(".ArticleHeadstyled__ArticleTeaserContainer-sc-1xd2qac-1");
var bodySpan = document.querySelector(".Textstyled__InlineText-sc-14jlruk-1"); 
var contentLoader = document.querySelector("#article > svg")
var contentLoaderGradient = document.querySelector(".ArticleContentLoaderstyled__Gradient-sc-1npmba7-0") 
if (paywall!=null) {
  paywall.remove();
  addContent(); 
} else if (paywall2!=null) {
  paywall2.remove();
  addContent();
}

function addContent() {
  contentLoader.remove()
contentLoaderGradient.remove() 
descriptionP.classList.remove("jgJYOM");
bodySpan.innerHTML = articleBody; 
bodySpan.parentElement.nextSibling.remove();
};