From f6280df24aaa930ecef751cf2d325047bc8021f7 Mon Sep 17 00:00:00 2001 From: magnolia1234 <7676006-magnolia1234@users.noreply.gitlab.com> Date: Thu, 9 Mar 2023 19:36:16 +0100 Subject: [PATCH] Fix NK News (not pro) --- background.js | 1 + changelog.txt | 1 + contentScript.js | 5 +++-- custom/sites_custom.json | 6 ++++++ sites.js | 8 ++++---- sites_updated.json | 4 ---- 6 files changed, 15 insertions(+), 10 deletions(-) diff --git a/background.js b/background.js index 3561ed22..0f2e322c 100644 --- a/background.js +++ b/background.js @@ -23,6 +23,7 @@ var restrictions = { 'dailywire.com': /^((?!\.dailywire\.com\/(episode|show|videos|watch)).)*$/, 'economictimes.com': /\.economictimes\.com($|\/($|(__assets|prime)(\/.+)?|.+\.cms))/, 'elespanol.com': /^((?!\/cronicaglobal\.elespanol\.com\/).)*$/, + 'elmercurio.com': /^((?!\.elmercurio\.com\/inversiones\/).)*$/, 'espn.com': /^((?!espn\.com\/watch).)*$/, 'esquire.com': /^((?!\/classic\.esquire\.com\/).)*$/, 'nknews.org': /^((?!nknews\.org\/pro\/).)*$/, diff --git a/changelog.txt b/changelog.txt index e41f46bb..0839be5b 100644 --- a/changelog.txt +++ b/changelog.txt @@ -7,6 +7,7 @@ Add Medienhaus Aachen Remove Rheinische Post Mediengruppe Fix Haaretz English Fix Inkl +Fix NK News (not pro) * v3.0.8.0 (2023-03-05) Add Bloomberg Adria diff --git a/contentScript.js b/contentScript.js index 9ad966a3..8798c072 100644 --- a/contentScript.js +++ b/contentScript.js @@ -66,13 +66,14 @@ if (bg2csData.ld_json) { let json = JSON.parse(json_script.text.replace(/[\r\n]/g, '').replace(/(\\r)?\\n/g, '
')); let json_key, json_text; if (Array.isArray(json)) { - json = json.filter(x => json_key = Object.keys(x).find(key => key.match(/^(articlebody|text)$/i))); + json = json.filter(x => json_key = Object.keys(x).find(key => key.match(/^articlebody$/i))) || json.filter(x => json_key = Object.keys(x).find(key => key.match(/^text$/i))); if (json_key) json_text = parseHtmlEntities(json[0][json_key]); } else { - json_key = Object.keys(json).find(key => key.match(/^(articlebody|text)$/i)); + json_key = Object.keys(json).find(key => key.match(/^articlebody$/i)) || Object.keys(json).find(key => key.match(/^text$/i)); json_text = parseHtmlEntities(json[json_key]); } + console.log(json_text); let content = document.querySelector(article_sel); if (json_text && content) { let parser = new DOMParser(); diff --git a/custom/sites_custom.json b/custom/sites_custom.json index c9ac2225..c40d2d98 100644 --- a/custom/sites_custom.json +++ b/custom/sites_custom.json @@ -152,6 +152,12 @@ "block_regex": "js\\.pelcro\\.com", "domain": "frieze.com" }, + "Gazetaprawna.pl": { + "allow_cookies": 1, + "amp_redirect": "div.displayMode_simplePaywall", + "domain": "gazetaprawna.pl", + "ld_json": "div.simplePaywall|article" + }, "Gazette.com": { "allow_cookies": 1, "block_regex": "loader-cdn\\.azureedge\\.net", diff --git a/sites.js b/sites.js index aff3cd61..ca48867b 100644 --- a/sites.js +++ b/sites.js @@ -476,7 +476,7 @@ var defaultSites = { allow_cookies: 1, block_regex: /(\.tinypass\.com\/|cdn\.cxense\.com\/|cdn\.ampproject\.org\/v\d\/amp-subscriptions-.+\.js)/ }, - "El Mercurio (+ regional/opt-in to custom sites)": { + "El Mercurio (not Inversiones; + regional/opt-in to custom sites)": { domain: "elmercurio.com", allow_cookies: 1, block_regex: /\.(elmercurio\.com|emol\.cl)\/(.+\/)?js\/(.+\/)?(modal|merPramV\d|PramModal\.min)\.js/, @@ -1451,9 +1451,9 @@ var defaultSites = { domain: "asia.nikkei.com", remove_cookies_select_drop: ["xbc"] }, - "NK News": { + "NK News (not pro)": { domain: "nknews.org", - remove_cookies_select_drop: ["issuem_lp", "issuem_lp_kp"] + remove_cookies_select_drop: ["issuem_lp"] }, "NRC Handelsblad": { domain: "nrc.nl", @@ -2310,7 +2310,7 @@ var defaultSites = { "Pico.tools": { domain: "pico.tools", allow_cookies: 1, - block_regex_general: /api\.pico.tools\// + block_regex_general: /api\.pico\.tools\// }, "Pigeon (WordPress plugin)": { domain: "###_wp_pigeon", diff --git a/sites_updated.json b/sites_updated.json index 8a3b3284..8dbfdc0a 100644 --- a/sites_updated.json +++ b/sites_updated.json @@ -29,10 +29,6 @@ "allow_cookies": 1, "ld_google_webcache": "#subscription-barrier|div.article-body,article" }, - "NK News (free articles only)": { - "domain": "nknews.org", - "remove_cookies_select_drop": ["issuem_lp", "issuem_lp_kp"] - }, "Quartz": { "domain": "qz.com", "allow_cookies": 1,