mirror of
https://gitlab.com/magnolia1234/bypass-paywalls-firefox-clean.git
synced 2024-11-10 05:57:48 +01:00
Add Kölner Stadt-Anzeiger & Kölnische Rundschau
This commit is contained in:
parent
658f205b26
commit
d553716d8c
5 changed files with 63 additions and 25 deletions
|
@ -375,6 +375,8 @@ Grouped in options:\
|
|||
[Frankfurter Allgemeine Zeitung](https://www.faz.net) -
|
||||
[Freie Presse](https://www.freiepresse.de) -
|
||||
[Handelsblatt](https://www.handelsblatt.com)* -
|
||||
[Kölner Stadt-Anzeiger](https://www.ksta.de) -
|
||||
[Kölnische Rundschau](https://www.rundschau-online.de) -
|
||||
[Krautreporter.de](https://krautreporter.de) -
|
||||
[Kurier.at](https://kurier.at) -
|
||||
[Mitteldeutsche Zeitung](https://www.mz.de) -
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
Changelog Bypass Paywalls Clean - Firefox
|
||||
|
||||
Post-release
|
||||
Add Koelner Stadt-Anzeiger & Koelnische Rundschau
|
||||
Fix Lecho.be (separate from Groupe Rossel)
|
||||
Fix Repubblica sites (no amp)
|
||||
|
||||
|
|
|
@ -466,30 +466,6 @@ else if (matchDomain('faz.net')) {
|
|||
return;
|
||||
let article_text = document.querySelector('.art_txt.paywall,.atc-Text.js-atc-Text');
|
||||
article_text.innerText = '';
|
||||
|
||||
const breakText = (str) => {
|
||||
str = str.replace(/(?:^|[A-Za-z\"\“])(\.|\?|!)(?=[A-ZÖÜ\„\d][A-Za-zÀ-ÿ\„\d]{1,})/gm, "$&\n\n");
|
||||
str = str.replace(/(([a-z]{2,}|[\"\“]))(?=[A-Z](?=[A-Za-zÀ-ÿ]+))/gm, "$&\n\n");
|
||||
// exceptions: names with alternating lower/uppercase (no general fix)
|
||||
let str_rep_arr = ['AstraZeneca', 'BaFin', 'BerlHG', 'BfArM', 'BilMoG', 'BioNTech', 'DiGA', 'EuGH', 'FinTechRat', 'GlaxoSmithKline', 'IfSG', 'medRxiv', 'mmHg', 'PlosOne', 'StVO'];
|
||||
let str_rep_split,
|
||||
str_rep_src;
|
||||
for (let str_rep of str_rep_arr) {
|
||||
str_rep_split = str_rep.split(/([a-z]+)(?=[A-Z](?=[A-Za-z]+))/);
|
||||
str_rep_src = str_rep_split.reduce(function (accumulator, currentValue) {
|
||||
return accumulator + currentValue + ((currentValue !== currentValue.toUpperCase()) ? '\n\n' : '');
|
||||
});
|
||||
if (str_rep_src.endsWith('\n\n'))
|
||||
str_rep_src = str_rep_src.slice(0, -2);
|
||||
str = str.replace(new RegExp(str_rep_src, "g"), str_rep);
|
||||
}
|
||||
str = str.replace(/De\n\n([A-Z])/g, "De$1");
|
||||
str = str.replace(/La\n\n([A-Z])/g, "La$1");
|
||||
str = str.replace(/Le\n\n([A-Z])/g, "Le$1");
|
||||
str = str.replace(/Mc\n\n([A-Z])/g, "Mc$1");
|
||||
return str;
|
||||
};
|
||||
|
||||
json_text = breakText(json_text);
|
||||
json_text.split("\n\n").forEach(
|
||||
(p_text) => {
|
||||
|
@ -557,6 +533,32 @@ else if (matchDomain('krautreporter.de')) {
|
|||
}
|
||||
}
|
||||
|
||||
else if (matchDomain(['ksta.de', 'rundschau-online.de'])) {
|
||||
let paywall = document.querySelector('.pay.wall');
|
||||
if (paywall) {
|
||||
removeDOMElement(paywall);
|
||||
let scripts = document.querySelectorAll('script[type="application/ld+json"]');
|
||||
let json;
|
||||
for (let script of scripts) {
|
||||
if (script.innerText.includes('articleBody'))
|
||||
json = script;
|
||||
}
|
||||
if (json) {
|
||||
let json_text = JSON.parse(json.text).articleBody;
|
||||
json_text = parseHtmlEntities(json_text);
|
||||
json_text = breakText(json_text);
|
||||
let region = 'ortsmarke';
|
||||
if (window.location.hostname === 'mobil.ksta.de')
|
||||
region = 'district';
|
||||
let article_sel = 'div.article-text > p.selectionShareable:not(.' + region + '), div.dm_article_text > p.selectionShareable:not(.' + region + ')';
|
||||
let article = document.querySelector(article_sel);
|
||||
if (article && json_text) {
|
||||
article.innerText = json_text;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if (matchDomain('kurier.at')) {
|
||||
let view_offer = document.querySelector('.view-offer');
|
||||
removeDOMElement(view_offer);
|
||||
|
@ -3023,6 +3025,29 @@ function pageContains(selector, text) {
|
|||
});
|
||||
}
|
||||
|
||||
function breakText(str) {
|
||||
str = str.replace(/(?:^|[A-Za-z\"\“])(\.|\?|!)(?=[A-ZÖÜ\„\d][A-Za-zÀ-ÿ\„\d]{1,})/gm, "$&\n\n");
|
||||
str = str.replace(/(([a-z]{2,}|[\"\“]))(?=[A-Z](?=[A-Za-zÀ-ÿ]+))/gm, "$&\n\n");
|
||||
// exceptions: names with alternating lower/uppercase (no general fix)
|
||||
let str_rep_arr = ['AstraZeneca', 'BaFin', 'BerlHG', 'BfArM', 'BilMoG', 'BioNTech', 'DiGA', 'EuGH', 'FinTechRat', 'GlaxoSmithKline', 'IfSG', 'medRxiv', 'mmHg', 'PlosOne', 'StVO'];
|
||||
let str_rep_split,
|
||||
str_rep_src;
|
||||
for (let str_rep of str_rep_arr) {
|
||||
str_rep_split = str_rep.split(/([a-z]+)(?=[A-Z](?=[A-Za-z]+))/);
|
||||
str_rep_src = str_rep_split.reduce(function (accumulator, currentValue) {
|
||||
return accumulator + currentValue + ((currentValue !== currentValue.toUpperCase()) ? '\n\n' : '');
|
||||
});
|
||||
if (str_rep_src.endsWith('\n\n'))
|
||||
str_rep_src = str_rep_src.slice(0, -2);
|
||||
str = str.replace(new RegExp(str_rep_src, "g"), str_rep);
|
||||
}
|
||||
str = str.replace(/De\n\n([A-Z])/g, "De$1");
|
||||
str = str.replace(/La\n\n([A-Z])/g, "La$1");
|
||||
str = str.replace(/Le\n\n([A-Z])/g, "Le$1");
|
||||
str = str.replace(/Mc\n\n([A-Z])/g, "Mc$1");
|
||||
return str;
|
||||
};
|
||||
|
||||
function parseHtmlEntities(encodedString) {
|
||||
let translate_re = /&(nbsp|amp|quot|lt|gt|deg|hellip|laquo|raquo|ldquo|rdquo|lsquo|rsquo|mdash);/g;
|
||||
let translate = {"nbsp": " ", "amp": "&", "quot": "\"", "lt": "<", "gt": ">", "deg": "°", "hellip": "…",
|
||||
|
|
|
@ -271,6 +271,7 @@
|
|||
"*://*.kn-online.de/*",
|
||||
"*://*.knack.be/*",
|
||||
"*://*.krautreporter.de/*",
|
||||
"*://*.ksta.de/*",
|
||||
"*://*.kurier.at/*",
|
||||
"*://*.la-croix.com/*",
|
||||
"*://*.labusinessjournal.com/*",
|
||||
|
@ -422,6 +423,7 @@
|
|||
"*://*.richmond.com/*",
|
||||
"*://*.rollingstone.com/*",
|
||||
"*://*.ruhrnachrichten.de/*",
|
||||
"*://*.rundschau-online.de/*",
|
||||
"*://*.sacbee.com/*",
|
||||
"*://*.sandiegouniontribune.com/*",
|
||||
"*://*.science-et-vie.com/*",
|
||||
|
@ -582,5 +584,5 @@
|
|||
"*://*.wallkit.net/*",
|
||||
"*://*.wsj.net/*"
|
||||
],
|
||||
"version": "2.4.6.1"
|
||||
"version": "2.4.6.2"
|
||||
}
|
||||
|
|
8
sites.js
8
sites.js
|
@ -739,6 +739,14 @@ var defaultSites = {
|
|||
allow_cookies: 1,
|
||||
block_regex: /(\.knack\.be\/js\/responsive\/rmg(Modal|Paywall)\.js|\.blueconic\.net\/)/
|
||||
},
|
||||
"Kölner Stadt-Anzeiger": {
|
||||
domain: "ksta.de",
|
||||
allow_cookies: 1
|
||||
},
|
||||
"Kölnische Rundschau": {
|
||||
domain: "rundschau-online.de",
|
||||
allow_cookies: 1
|
||||
},
|
||||
"Krautreporter.de": {
|
||||
domain: "krautreporter.de"
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue