From b03c048b76ec2879ffe265527d2f619cc04b27cc Mon Sep 17 00:00:00 2001 From: magnolia1234 <7676006-magnolia1234@users.noreply.gitlab.com> Date: Wed, 30 Nov 2022 08:56:21 +0100 Subject: [PATCH] Add Welt.de (link to archive.is) --- README.md | 1 + changelog.txt | 1 + contentScript.js | 36 +++++++++++++++++++++++++++--------- manifest.json | 3 ++- sites.js | 6 +++++- sites_updated.json | 27 --------------------------- 6 files changed, 36 insertions(+), 38 deletions(-) diff --git a/README.md b/README.md index 3b65961d..8894ce0e 100644 --- a/README.md +++ b/README.md @@ -517,6 +517,7 @@ Grouped in options:\ [Der Spiegel (link to archive.is)](https://www.spiegel.de) - [Der Tagesspiegel (link to archive.is)](https://www.tagesspiegel.de) - [Die Rheinpfalz](https://www.rheinpfalz.de) - +[Die Welt (link to archive.is)](https://www.welt.de) - [Die Zeit](https://www.zeit.de) - [Frankfurter Allgemeine Zeitung](https://www.faz.net) - [Freie Presse](https://www.freiepresse.de) - diff --git a/changelog.txt b/changelog.txt index 07333dcc..312e507e 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,6 +2,7 @@ Changelog Bypass Paywalls Clean - Firefox Post-release +Add Welt.de (link to archive.is) Remove BusinessPost.ie (fix obsolete) * v2.9.5.0 (2022-11-27) diff --git a/contentScript.js b/contentScript.js index 4582eae9..c193f2ec 100644 --- a/contentScript.js +++ b/contentScript.js @@ -9,7 +9,7 @@ var ca_gcm_domains = ['lesoleil.com'].concat(['latribune.ca', 'lavoixdelest.ca', var ca_torstar_domains = ['niagarafallsreview.ca', 'stcatharinesstandard.ca', 'thepeterboroughexaminer.com', 'therecord.com', 'thespec.com', 'thestar.com', 'wellandtribune.ca']; var de_funke_medien_domains = ['abendblatt.de', 'braunschweiger-zeitung.de', 'morgenpost.de', 'nrz.de', 'otz.de', 'thueringer-allgemeine.de', 'tlz.de', 'waz.de', 'wp.de', 'wr.de']; var de_madsack_domains = ['haz.de', 'kn-online.de', 'ln-online.de', 'lvz.de', 'maz-online.de', 'neuepresse.de', 'ostsee-zeitung.de', 'rnd.de']; -var de_madsack_custom_domains = ['aller-zeitung.de', 'dnn.de', 'gnz.de', 'goettinger-tageblatt.de', 'paz-online.de', 'sn-online.de', 'waz-online.de']; +var de_madsack_custom_domains = ['aller-zeitung.de', 'dnn.de', 'gnz.de', 'goettinger-tageblatt.de', 'op-marburg.de', 'paz-online.de', 'sn-online.de', 'waz-online.de']; var de_westfalen_medien_domains = ['muensterschezeitung.de', 'westfalen-blatt.de', 'wn.de']; var es_epiberica_domains = ['diariodemallorca.es', 'eldia.es', 'epe.es', 'farodevigo.es', 'informacion.es', 'laprovincia.es', 'levante-emv.com', 'lne.es', 'mallorcazeitung.es']; var es_epiberica_custom_domains = ['diaridegirona.cat', 'diariocordoba.com', 'diariodeibiza.es', 'elperiodicodearagon.com', 'elperiodicoextremadura.com', 'elperiodicomediterraneo.com', 'emporda.info', 'laopinioncoruna.es', 'laopiniondemalaga.es', 'laopiniondemurcia.es', 'laopiniondezamora.es', 'regio7.cat']; @@ -50,7 +50,7 @@ function getArticleJsonScript() { let scripts = document.querySelectorAll('script[type="application/ld+json"]'); let json_script; for (let script of scripts) { - if (script.innerText.includes('articleBody')) { + if (script.innerText.match(/"(articleBody|text)":/)) { json_script = script; break; } @@ -72,13 +72,18 @@ if ((bg2csData !== undefined) && bg2csData.ld_json && dompurify_loaded) { removeDOMElement(...paywall); let json_script = getArticleJsonScript(); if (json_script) { - let json_text = parseHtmlEntities(JSON.parse(json_script.text).articleBody); - let content = document.querySelector(article_sel); - if (json_text && content) { - let parser = new DOMParser(); - let doc = parser.parseFromString('
' + DOMPurify.sanitize(json_text) + '
', 'text/html'); - let content_new = doc.querySelector('div'); - content.parentNode.replaceChild(content_new, content); + try { + let json = JSON.parse(json_script.text); + let json_text = parseHtmlEntities(json.articleBody ? json.articleBody : json.text); + let content = document.querySelector(article_sel); + if (json_text && content) { + let parser = new DOMParser(); + let doc = parser.parseFromString('
' + DOMPurify.sanitize(json_text) + '
', 'text/html'); + let content_new = doc.querySelector('div'); + content.parentNode.replaceChild(content_new, content); + } + } catch (err) { + console.log(err); } } } @@ -747,6 +752,19 @@ else if (matchDomain('tagesspiegel.de')) { } } +else if (matchDomain('welt.de')) { + let url = window.location.href; + let paywall = document.querySelector('div[data-premium-content-loader-id^="spinner-article-"]'); + if (paywall) { + removeDOMElement(paywall); + let article = document.querySelector('div[data-qa="Article.PremiumContent"]'); + if (article) + article.insertBefore(archiveLink(url), article.firstChild); + } + let ads = document.querySelectorAll('div[data-component="Outbrain"], div[data-component="OEmbedComponent"], div[class*="c-ad"]'); + removeDOMElement(...ads); +} + else if (matchDomain(de_westfalen_medien_domains)) { let url = window.location.href; if (url.includes('/amp/')) { diff --git a/manifest.json b/manifest.json index ec2f5808..c20888b4 100644 --- a/manifest.json +++ b/manifest.json @@ -668,6 +668,7 @@ "*://*.waz.de/*", "*://*.weeklytimesnow.com.au/*", "*://*.wellandtribune.ca/*", + "*://*.welt.de/*", "*://*.weltkunst.de/*", "*://*.westernadvocate.com.au/*", "*://*.westfalen-blatt.de/*", @@ -730,5 +731,5 @@ "*://gcm.omerlocdn.com/*", "*://webcache.googleusercontent.com/*" ], - "version": "2.9.5.0" + "version": "2.9.5.1" } diff --git a/sites.js b/sites.js index bd9017b2..d585b0f5 100644 --- a/sites.js +++ b/sites.js @@ -389,6 +389,10 @@ var defaultSites = { allow_cookies: 1, useragent: "googlebot" }, + "Die Welt (link to archive.is)": { + domain: "welt.de", + allow_cookies: 1 + }, "Die Zeit": { domain: "zeit.de", allow_cookies: 1, @@ -2390,4 +2394,4 @@ init_custom_domains(); // sites with no fix (background) var be_mediahuis_nofix_domains = ['gva.be', 'hbvl.be']; var it_gedi_nofix_domains = ['gelocal.it', 'huffingtonpost.it', 'ilsecoloxix.it', 'lastampa.it', 'limesonline.com']; -var nofix_sites = ['africaintelligence.com', 'africaintelligence.fr', 'aftenposten.no', 'badische-zeitung.de', 'bild.de', 'borsen.dk', 'businesstimes.com.sg', 'caixin.com', 'caixinglobal.com', 'caravanmagazine.in', 'courrierinternational.com', 'dn.no', 'dn.se', 'elordenmundial.com', 'epw.in', 'expresso.pt', 'ftchinese.com', 'handelsblatt.com', 'hs.fi', 'ilsole24ore.com', 'jacobinmag.com', 'jeuneafrique.com', 'kurier.at', 'lavie.fr', 'lavozdegalicia.es', 'leconomiste.com', 'lefigaro.fr', 'lemonde.fr', 'lepoint.fr', 'letemps.ch', 'liberation.fr', 'medianama.com', 'mediapart.fr', 'milanofinanza.it', 'mondediplo.com', 'moneycontrol.com', 'nature.com', 'nbr.co.nz', 'nn.de', 'ouest-france.fr', 'politiken.dk', 'pressreader.com', 'publico.pt', 'republic.ru', 'saechsische.de', 'statnews.com', 'stern.de', 'straitstimes.com', 'sueddeutsche.de', 'suedkurier.de', 'swp.de', 'tagesanzeiger.ch', 'the-ken.com', 'theinformation.com', 'themorningcontext.com', 'theparisreview.org', 'thewirechina.com', 'welt.de', 'weser-kurier.de', 'worldpoliticsreview.com', 'ynet.co.il', 'zerohedge.com'].concat(be_mediahuis_nofix_domains, it_gedi_nofix_domains); +var nofix_sites = ['africaintelligence.com', 'africaintelligence.fr', 'aftenposten.no', 'badische-zeitung.de', 'bild.de', 'borsen.dk', 'businesstimes.com.sg', 'caixin.com', 'caixinglobal.com', 'caravanmagazine.in', 'courrierinternational.com', 'dn.no', 'dn.se', 'elordenmundial.com', 'epw.in', 'expresso.pt', 'ftchinese.com', 'handelsblatt.com', 'hs.fi', 'ilsole24ore.com', 'jacobinmag.com', 'jeuneafrique.com', 'kurier.at', 'lavie.fr', 'lavozdegalicia.es', 'leconomiste.com', 'lefigaro.fr', 'lemonde.fr', 'lepoint.fr', 'letemps.ch', 'liberation.fr', 'medianama.com', 'mediapart.fr', 'milanofinanza.it', 'mondediplo.com', 'moneycontrol.com', 'nature.com', 'nbr.co.nz', 'nn.de', 'ouest-france.fr', 'politiken.dk', 'pressreader.com', 'publico.pt', 'republic.ru', 'saechsische.de', 'schwarzwaelder-bote.de', 'statnews.com', 'stern.de', 'straitstimes.com', 'stuttgarter-nachrichten.de', 'stuttgarter-zeitung.de', 'sueddeutsche.de', 'suedkurier.de', 'swp.de', 'tagesanzeiger.ch', 'the-ken.com', 'theinformation.com', 'themorningcontext.com', 'theparisreview.org', 'thewirechina.com', 'weser-kurier.de', 'worldpoliticsreview.com', 'ynet.co.il', 'zerohedge.com'].concat(be_mediahuis_nofix_domains, it_gedi_nofix_domains); diff --git a/sites_updated.json b/sites_updated.json index d2b0284a..3262665a 100644 --- a/sites_updated.json +++ b/sites_updated.json @@ -1,31 +1,4 @@ { - "CNBC": { - "domain": "cnbc.com", - "allow_cookies": 1, - "block_regex": "\\.tinypass\\.com\\/", - "cs_code": [{ - "cond": "div.ArticleGate-proGate", - "rm_elem": 1, - "elems": [{ - "cond": "span[hidden]", - "rm_attrib": "class" - }, { - "cond": "span[hidden]", - "rm_attrib": "hidden" - } - ] - }], - "new_site": 1 - }, - "Dagens ETC": { - "domain": "etc.se", - "allow_cookies": 1, - "cs_code": [{ - "cond": "div.paywalled", - "rm_attrib": "class" - }], - "new_site": 1 - }, "La Vanguardia": { "domain": "lavanguardia.com", "allow_cookies": 1,