Add Outlook India

This commit is contained in:
magnolia1234 2022-04-18 08:14:17 +02:00
parent f422de0f30
commit daa461e37f
7 changed files with 40 additions and 6 deletions

View File

@ -689,6 +689,7 @@ Grouped in options:\
[LiveMint](https://www.livemint.com) -
[MediaNama](https://www.medianama.com) -
[Mid-Day](https://www.mid-day.com) -
[Outlook](https://www.outlookindia.com) -
[The Economic Times (ET Prime)](https://economictimes.indiatimes.com) -
[The Hindu](https://www.thehindu.com) -
[The Hindu BusinessLine](https://www.thehindubusinessline.com) -

View File

@ -149,7 +149,7 @@ function set_rules(sites, sites_updated, sites_custom) {
let site_default = defaultSites.hasOwnProperty(site) ? site : Object.keys(defaultSites).find(default_key => compareKey(default_key, site));
if (site_default) {
rule = defaultSites[site_default];
if (sites_updated.hasOwnProperty(site_default))
if (sites_updated.hasOwnProperty(site_default) && !sites_updated[site_default].new_site)
rule = sites_updated[site_default];
} else if (sites_updated.hasOwnProperty(site)) { // updated (new) sites
rule = sites_updated[site];

View File

@ -5,6 +5,7 @@ Post-release
Add Aftonbladet.se
Add Investors' Chronicle (UK)
Add Nzz.ch Regional (opt-in to custom sites)
Add Outlook India
Fix ABC.es (mobile)
Fix Adweek (free articles only)
Fix Quartz (newsletter)

View File

@ -64,7 +64,7 @@ if ((bg2csData !== undefined) && bg2csData.ld_json && dompurify_loaded) {
removeDOMElement(paywall);
let json_script = getArticleJsonScript();
if (json_script) {
let json_text = JSON.parse(json_script.text).articleBody;
let json_text = parseHtmlEntities(JSON.parse(json_script.text).articleBody);
let content = document.querySelector(article_sel);
if (json_text && content) {
let parser = new DOMParser();
@ -2753,7 +2753,7 @@ else if (matchDomain('hilltimes.com')) {
if (json_script) {
let json = JSON.parse(json_script.text).filter(x => x.articleBody)[0];
if (json) {
let json_text = json.articleBody.replace(/ /g, '').replace(/(\.|\%)\s{3,}/g, "$&\r\n\r\n");
let json_text = parseHtmlEntities(json.articleBody).replace(/(\.|\%)\s{3,}/g, "$&\r\n\r\n");
let content = document.querySelector('div#xorg');
if (json_text && content)
content.innerText = '\r\n' + json_text;
@ -3120,6 +3120,27 @@ else if (matchDomain('nytimes.com')) {
}
}
else if (matchDomain('outlookindia.com')) {
let paywall = document.querySelector('div.paywall');
if (paywall) {
removeDOMElement(paywall);
let json_script = getArticleJsonScript();
if (json_script) {
let json = JSON.parse(json_script.text);
if (json) {
let json_text = parseHtmlEntities(json.articleBody).replace(/\n/g, "$&\r\n");
let content = document.querySelector('div#articleBody');
if (json_text && content) {
content.innerHTML = '';
let article_new = document.createElement('p');
article_new.innerText = json_text;
content.appendChild(article_new);
}
}
}
}
}
else if (matchDomain('quora.com')) {
let overlays = document.querySelectorAll('div[class*="_overlay"]');
removeDOMElement(...overlays);
@ -3956,9 +3977,9 @@ function breakText(str) {
};
function parseHtmlEntities(encodedString) {
let translate_re = /&(nbsp|amp|quot|lt|gt|deg|hellip|laquo|raquo|ldquo|rdquo|lsquo|rsquo|mdash);/g;
let translate_re = /&(nbsp|amp|quot|lt|gt|deg|hellip|laquo|raquo|ldquo|rdquo|lsquo|rsquo|mdash|shy);/g;
let translate = {"nbsp": " ", "amp": "&", "quot": "\"", "lt": "<", "gt": ">", "deg": "°", "hellip": "…",
"laquo": "«", "raquo": "»", "ldquo": "“", "rdquo": "”", "lsquo": "", "rsquo": "", "mdash": "—"};
"laquo": "«", "raquo": "»", "ldquo": "“", "rdquo": "”", "lsquo": "", "rsquo": "", "mdash": "—", "shy": ""};
return encodedString.replace(translate_re, function (match, entity) {
return translate[entity];
}).replace(/&#(\d+);/gi, function (match, numStr) {

View File

@ -445,6 +445,7 @@
"*://*.orlandosentinel.com/*",
"*://*.ostsee-zeitung.de/*",
"*://*.otz.de/*",
"*://*.outlookindia.com/*",
"*://*.outsideonline.com/*",
"*://*.oxygenmag.com/*",
"*://*.paloaltoonline.com/*",
@ -666,5 +667,5 @@
"*://*.wsj.net/*",
"*://webcache.googleusercontent.com/*"
],
"version": "2.6.4.6"
"version": "2.6.4.7"
}

View File

@ -1277,6 +1277,10 @@ var defaultSites = {
allow_cookies: 1,
block_regex: /(\.tinypass\.com\/|cdn\.ampproject\.org\/v\d\/amp-((sticky-)?ad|subscriptions)-.+\.js)/
},
"Outlook India": {
domain: "outlookindia.com",
allow_cookies: 1
},
"Outside magazines": {
domain: "###_usa_outside_mag",
group: [

View File

@ -24,5 +24,11 @@
"Nürnberger Nachrichten": {
"domain": "nn.de",
"block_regex": "(cdn\\.cxense\\.com\\/|\\.piano\\.io\\/)"
},
"Outlook India": {
"domain": "outlookindia.com",
"allow_cookies": 1,
"ld_json": "div.paywall|div#articleBody",
"new_site": 1
}
}