Add The Verge (newsletter)

Fix Weltkunst.de
This commit is contained in:
magnolia1234 2023-07-30 10:02:19 +02:00
parent 0be7995baa
commit 0c44053f1a
7 changed files with 119 additions and 41 deletions

View File

@ -216,6 +216,7 @@ Grouped in options:\
[The New York Review of Books](https://www.nybooks.com) -
[The Point Magazine](https://thepointmag.com) -
[The Spectator World](https://thespectator.com) -
[The Verge](https://www.theverge.com) -
[The Wrap](https://www.thewrap.com)
Grouped in options:\

View File

@ -6,6 +6,7 @@ Post-release
Add Mannheimer-Morgen.de (Haas)
Add RuhrNachrichten.de (+ Media Group Westfalen; opt-in to custom sites)
Add Stereogum
Add The Verge (newsletter)
Remove Allgaeuer-Zeitung.de (fix obsolete)
Fix Automobilwoche.de (js)
Fix BizJournals (anti-adblocker)
@ -15,6 +16,7 @@ Fix New Scientist (regwall)
Fix Star Tribune (mobile)
Fix The Japan Times (json for archive)
Fix Verlagsgruppe Rhein Main
Fix Weltkunst.de
Maintenance updated sites (clear)
* v3.2.6.0 (2023-07-23)

View File

@ -1012,33 +1012,6 @@ else if (matchDomain(['stuttgarter-nachrichten.de', 'stuttgarter-zeitung.de', 's
removeDOMElement(banner);
}
else if (matchDomain('weltkunst.de')) {
let paywall = document.querySelector('section.paywall');
if (paywall && dompurify_loaded) {
removeDOMElement(paywall);
let json_url_dom = document.querySelector('link[rel="alternate"][type="application/json"][href]');
let json_url = json_url_dom.href;
fetch(json_url)
.then(response => {
if (response.ok) {
response.json().then(json => {
let json_text = json.content.rendered;
let content = document.querySelector('div.article div.text');
if (json_text && content) {
let parser = new DOMParser();
let doc = parser.parseFromString('<div>' + DOMPurify.sanitize(json_text) + '</div>', 'text/html');
let content_new = doc.querySelector('div');
content.innerHTML = '';
content.appendChild(content_new);
}
});
}
});
}
let par_initial = document.querySelector('p.initial');
removeDOMElement(par_initial);
}
else if (matchDomain('zeit.de')) {
let url = window.location.href;
let paywall = document.querySelector('aside#paywall');
@ -1869,14 +1842,6 @@ else if (matchDomain('eastwest.eu')) {
}
else if (matchDomain('gazzetta.it')) {
function header_nofix(header) {
if (header) {
let nofix_div = document.createElement('div');
nofix_div.setAttribute('style', 'margin: 20px; font-weight: bold; color: red;');
nofix_div.innerText = 'BPC > no fix';
header.appendChild(nofix_div);
}
}
if (window.location.pathname.endsWith('_preview.shtml')) {
let paywall = document.querySelector('section.bck-freemium__wall');
if (paywall) {
@ -2921,7 +2886,7 @@ else if (matchDomain(uk_nat_world_domains) || document.querySelector('footer > d
else
csDone = true;
} else if (window.location.hostname.match(/\.(ar|br|cl|pe|uy)$/) || matchDomain(['clarin.com', 'elespectador.com', 'elmercurio.com', 'eltiempo.com', 'eltribuno.com', 'lasegunda.com', 'latercera.com', 'valor.globo.com'])) {//south america
} else if (window.location.hostname.match(/\.(ar|br|cl|pe|uy)$/) || matchDomain(['clarin.com', 'elespectador.com', 'elmercurio.com', 'eltiempo.com', 'eltribuno.com', 'globo.com', 'lasegunda.com', 'latercera.com'])) {//south america
if (matchDomain('abril.com.br')) {
if (window.location.pathname.endsWith('/amp/')) {
@ -3112,7 +3077,7 @@ else if (matchDomain('lasegunda.com')) {
}
}
else if (matchDomain('valor.globo.com')) {
else if (matchDomain('globo.com')) {
let url = window.location.href;
if (!window.location.pathname.startsWith('/google/amp/')) {
let paywall = document.querySelector('div.paywall');
@ -4776,6 +4741,89 @@ else if (matchDomain('thequint.com')) {
}
}
else if (matchDomain('theverge.com')) {
let paywall = document.querySelector('div.bg-paywall-fade');
if (paywall && dompurify_loaded) {
removeDOMElement(paywall);
let json_script = document.querySelector('script#__NEXT_DATA__');
if (json_script) {
try {
let json = JSON.parse(json_script.text);
let article = document.querySelector('div.duet--article--article-body-component-container');
if (json && article) {
let json_pars = json.props.pageProps.hydration.responses[0].data.entryRevision.body.components;
article.innerHTML = '';
let parser = new DOMParser();
for (let par of json_pars) {
let elem = document.createElement('p');
elem.style = 'margin: 20px 0px;';
let type = par.__typename;
if (['EntryBodyParagraph', 'EntryBodyHeading'].includes(type)) {
if (par.contents && par.contents.html) {
if (type === 'EntryBodyHeading')
elem.style = 'font-weight: bold;';
let doc = parser.parseFromString('<div>' + DOMPurify.sanitize(par.contents.html) + '</div>', 'text/html');
elem.appendChild(doc.querySelector('div'));
}
} else if (type === 'EntryBodyHorizontalRule') {
elem.appendChild(document.createElement('hr'));
} else if (type === 'EntryBodyImage') {
if (par.image && par.image.url) {
let figure = document.createElement('figure');
if (par.image.asset && par.image.asset.title)
figure.appendChild(document.createTextNode(par.image.asset.title));
let img = document.createElement('img');
img.src = par.image.url;
figure.appendChild(img);
if (par.image.caption && par.image.caption.html) {
let caption = document.createElement('figcaption');
caption.innerText = par.image.caption.html;
if (par.image.credit && par.image.credit.html)
caption.innerText += ' - ' + par.image.credit.html;
figure.appendChild(caption);
}
elem.appendChild(figure);
}
} else if (type === 'EntryBodyPullquote') {
if (par.quote && par.quote.html) {
let doc = parser.parseFromString('<div>' + DOMPurify.sanitize(par.quote.html) + '</div>', 'text/html');
elem.appendChild(doc.querySelector('div'));
}
} else if (type === 'EntryBodyBlockquote') {
if (par.paragraphs) {
for (let quote_par of par.paragraphs) {
if (quote_par.contents && quote_par.contents.html) {
let doc = parser.parseFromString('<div>' + DOMPurify.sanitize(quote_par.contents.html) + '</div>', 'text/html');
elem.appendChild(doc.querySelector('div'));
}
}
}
} else if (type === 'EntryBodyList') {
if (par.items) {
let ul = document.createElement('ul');
for (let item of par.items) {
if (item.line && item.line.html) {
let li = document.createElement('li');
let doc = parser.parseFromString('<div>' + DOMPurify.sanitize(item.line.html) + '</div>', 'text/html');
li.appendChild(doc.querySelector('div'));
ul.appendChild(li);
}
}
elem.appendChild(ul);
}
} else
console.log(par);
if (elem.hasChildNodes)
article.appendChild(elem);
}
}
} catch (err) {
console.log(err);
}
}
}
}
else if (matchDomain('thewrap.com')) {
let paywall = document.querySelector('.wrappro-paywall');
if (paywall)
@ -5198,6 +5246,15 @@ function matchUrlDomain(domains, url) {
return matchDomain(domains, urlHost(url));
}
function header_nofix(header) {
if (header) {
let nofix_div = document.createElement('div');
nofix_div.setAttribute('style', 'margin: 20px; font-weight: bold; color: red;');
nofix_div.innerText = 'BPC > no fix';
header.appendChild(nofix_div);
}
}
function replaceDomElementExt(url, proxy, base64, selector, text_fail = '', selector_source = selector) {
if (proxy) {
if (!text_fail) {

View File

@ -51,5 +51,5 @@
"webRequestBlocking",
"*://*/*"
],
"version": "3.2.6.7"
"version": "3.2.6.8"
}

View File

@ -658,6 +658,7 @@
"*://*.thestar.com/*",
"*://*.thestate.com/*",
"*://*.thetimes.co.uk/*",
"*://*.theverge.com/*",
"*://*.thewest.com.au/*",
"*://*.thewrap.com/*",
"*://*.thueringer-allgemeine.de/*",
@ -770,5 +771,5 @@
"*://*.wyleex.com/*",
"*://webcache.googleusercontent.com/*"
],
"version": "3.2.6.7"
"version": "3.2.6.8"
}

View File

@ -2247,6 +2247,11 @@ var defaultSites = {
block_regex: /(\.(com|ca)\/shared-content\/art\/tncms\/user\/user\.js|cdn\.ampproject\.org\/v\d\/amp-access-.+\.js)/,
cs_dompurify: 1
},
"The Verge (newsletter)": {
domain: "theverge.com",
allow_cookies: 1,
cs_dompurify: 1
},
"The Wall Street Journal (when blocked disable Googlebot in BPC-settings)": {
domain: "wsj.com",
allow_cookies: 1,
@ -2354,7 +2359,7 @@ var defaultSites = {
"Weltkunst": {
domain: "weltkunst.de",
allow_cookies: 1,
cs_dompurify: 1
useragent: "googlebot"
},
"Westdeutsche Zeitung": {
allow_cookies: 1,
@ -2622,4 +2627,4 @@ init_custom_flex_domains();
// sites with no fix (background)
var it_gedi_nofix_domains = ['gelocal.it', 'huffingtonpost.it', 'ilsecoloxix.it', 'lastampa.it', 'limesonline.com', 'repubblica.it'];
var nofix_sites = ['aamulehti.fi', 'africaintelligence.com', 'africaintelligence.fr', 'aftonbladet.se', 'aftenposten.no', 'allgaeuer-zeitung.de', 'asiatimes.com', 'badische-zeitung.de', 'bild.de', 'bloomberglaw.com', 'bloombergtax.com', 'borsen.dk', 'businessinsider.de', 'businesstimes.com.sg', 'caixin.com', 'caixinglobal.com', 'caravanmagazine.in', 'catalyst-journal.com', 'compactmag.com', 'courrierinternational.com', 'deutsche-wirtschafts-nachrichten.de', 'diepresse.com', 'dn.se', 'elordenmundial.com', 'epw.in', 'expresso.pt', 'finance.si', 'ftchinese.com', 'gamestar.de', 'geo.de', 'golem.de', 'handelsblatt.com', 'heise.de', 'hs.fi', 'ilsole24ore.com', 'investors.com', 'iltalehti.fi', 'jacobinmag.com', 'jeuneafrique.com', 'kleinezeitung.at', 'lavie.fr', 'lavozdegalicia.es', 'law360.com', 'lefigaro.fr', 'le1hebdo.fr', 'leconomiste.com', 'lefilmfrancais.com', 'lemonde.fr', 'lepoint.fr', 'lequipe.fr', 'letemps.ch', 'liberation.fr', 'limburger.nl', 'lopinion.fr', 'mainpost.de', 'medianama.com', 'mediapart.fr', 'milanofinanza.it', 'mittelbayerische.de', 'monde-diplomatique.fr', 'mondediplo.com', 'moneycontrol.com', 'morningstar.com', 'nationaljournal.com', 'manager-magazin.de', 'mz.de', 'nature.com', 'nbr.co.nz', 'nn.de', 'ouest-france.fr', 'philonomist.com', 'pnp.de', 'politicopro.com', 'politiken.dk', 'pressreader.com', 'publico.pt', 'quillette.com', 'republic.ru', 'rheinpfalz.de', 'risk.net', 'rnz.de', 'saechsische.de', 'statnews.com', 'stern.de', 'stimme.de', 'straitstimes.com', 'stratfor.com', 'substack.com', 'sueddeutsche.de', 'suedkurier.de', 'swp.de', 'tagesspiegel.de', 'techcrunch.com', 'the-ken.com', 'theinformation.com', 'themorningcontext.com', 'theparisreview.org', 'thewirechina.com', 'volksstimme.de', 'welt.de', 'weser-kurier.de', 'wiwo.de', 'worldpoliticsreview.com', 'ynet.co.il'].concat(it_gedi_nofix_domains);
var nofix_sites = ['aamulehti.fi', 'africaintelligence.com', 'africaintelligence.fr', 'aftonbladet.se', 'aftenposten.no', 'allgaeuer-zeitung.de', 'asiatimes.com', 'badische-zeitung.de', 'bild.de', 'bloomberglaw.com', 'bloombergtax.com', 'borsen.dk', 'businessinsider.de', 'businesstimes.com.sg', 'caixin.com', 'caixinglobal.com', 'caravanmagazine.in', 'catalyst-journal.com', 'compactmag.com', 'courrierinternational.com', 'deutsche-wirtschafts-nachrichten.de', 'diepresse.com', 'dn.se', 'elordenmundial.com', 'epw.in', 'expresso.pt', 'finance.si', 'ftchinese.com', 'gamestar.de', 'geo.de', 'golem.de', 'handelsblatt.com', 'heise.de', 'hs.fi', 'ilsole24ore.com', 'investors.com', 'iltalehti.fi', 'jacobinmag.com', 'jeuneafrique.com', 'kleinezeitung.at', 'lavie.fr', 'lavozdegalicia.es', 'law360.com', 'lefigaro.fr', 'le1hebdo.fr', 'leconomiste.com', 'lefilmfrancais.com', 'lemonde.fr', 'lepoint.fr', 'lequipe.fr', 'letemps.ch', 'liberation.fr', 'limburger.nl', 'lopinion.fr', 'mainpost.de', 'medianama.com', 'mediapart.fr', 'milanofinanza.it', 'mittelbayerische.de', 'monde-diplomatique.fr', 'mondediplo.com', 'moneycontrol.com', 'morningstar.com', 'nachrichten.at', 'nationaljournal.com', 'manager-magazin.de', 'mz.de', 'nature.com', 'nbr.co.nz', 'nn.de', 'ouest-france.fr', 'philonomist.com', 'pnp.de', 'politicopro.com', 'politiken.dk', 'pressreader.com', 'publico.pt', 'quillette.com', 'republic.ru', 'rheinpfalz.de', 'risk.net', 'rnz.de', 'saechsische.de', 'statnews.com', 'stern.de', 'stimme.de', 'straitstimes.com', 'stratfor.com', 'substack.com', 'sueddeutsche.de', 'suedkurier.de', 'swp.de', 'tagesspiegel.de', 'techcrunch.com', 'the-ken.com', 'theinformation.com', 'themorningcontext.com', 'theparisreview.org', 'thewirechina.com', 'volksstimme.de', 'welt.de', 'weser-kurier.de', 'wiwo.de', 'worldpoliticsreview.com', 'ynet.co.il'].concat(it_gedi_nofix_domains);

View File

@ -193,6 +193,12 @@
"useragent": "googlebot",
"upd_version": "3.1.4.0"
},
"The Verge (newsletter)": {
"domain": "theverge.com",
"allow_cookies": 1,
"ld_json": "div.bg-paywall-fade|div.duet--article--article-body-component-container",
"new_site": 1
},
"Verlagsgruppe Rhein Main": {
"allow_cookies": 1,
"domain": "###_de_vrm",
@ -204,5 +210,11 @@
"block_regex": "cdn\\.cxense\\.com",
"useragent": "googlebot",
"upd_version": "3.2.6.7"
},
"Weltkunst": {
"domain": "weltkunst.de",
"allow_cookies": 1,
"useragent": "googlebot",
"upd_version": "3.2.6.9"
}
}