Fix-update The Economic Times (mobile/India)

This commit is contained in:
magnolia1234 2021-05-21 08:04:59 +02:00
parent 6d9d642dfe
commit c1b7d062a6
5 changed files with 59 additions and 6 deletions

View file

@ -16,6 +16,7 @@ const restrictions = {
'adweek.com': /^((?!\.adweek\.com\/(.+\/)?(amp|agencyspy|tvnewser|tvspy)\/).)*$/,
'barrons.com': /.+\.barrons\.com\/(amp\/)?article(s)?\/.+/,
'bloombergquint.com': /^((?!\.bloombergquint\.com\/bq-blue-exclusive\/).)*$/,
'economictimes.com': /.+\.economictimes\.com\/($|(__assets|prime)(\/.+)?|.+\.cms)/,
'elcomercio.pe': /.+\/elcomercio\.pe\/.+((\w)+(\-)+){3,}.+/,
'elespanol.com': /^((?!\/cronicaglobal\.elespanol\.com\/).)*$/,
'elpais.com': /(\/elpais\.com\/$|\/(.+\.)?elpais\.com\/.+\.html)/,
@ -25,7 +26,7 @@ const restrictions = {
'gestion.pe': /.+\/gestion\.pe\/.+((\w)+(\-)+){3,}.+/,
'globo.com': /^((?!\/valor\.globo\.com\/).)*$/,
'medianama.com': /\.medianama\.com\/(\d){4}\/(\d){2}\//,
'timesofindia.com': /.+\.timesofindia\.com\/(toi-plus(\/.+)?|.+\.cms)/,
'timesofindia.com': /.+\.timesofindia\.com\/($|toi-plus(\/.+)?|.+\.cms)/,
'nknews.org': /^((?!nknews\.org\/pro\/).)*$/,
'quora.com': /^((?!quora\.com\/search\?q=).)*$/,
'seekingalpha.com': /.+\/seekingalpha\.com\/($|(amp\/)?(article|news)\/|samw\/)/,
@ -57,7 +58,6 @@ var allow_cookies_default = [
'di.se',
'dn.se',
'dvhn.nl',
'economictimes.indiatimes.com',
'editorialedomani.it',
'elconfidencial.com',
'elespanol.com',
@ -225,7 +225,6 @@ var use_google_bot_default = [
'nouvelobs.com',
'nzz.ch',
'piqd.de',
'economictimes.indiatimes.com',
'quora.com',
'republic.ru',
'rhein-zeitung.de',
@ -440,6 +439,7 @@ var grouped_sites = {
'###_ca_torstar': ca_torstar_domains,
'###_de_funke_medien': de_funke_media_domains,
'###_de_madsack': de_madsack_domains,
'###_economictimes': economictimes_domains,
'###_es_grupo_vocento': es_grupo_vocento_domains,
'###_fi_alma_talent': fi_alma_talent_domains,
'###_fr_be_groupe_rossel': fr_be_groupe_rossel_domains,
@ -499,6 +499,10 @@ function add_grouped_sites(init_rules) {
allow_cookies.push(domain);
blockedRegexes[domain] = /cdn\.ampproject\.org\/v\d\/amp-(ad|subscriptions)-.+\.js/;
}
for (let domain of economictimes_domains) {
allow_cookies.push(domain);
use_google_bot.push(domain);
}
for (let domain of es_grupo_vocento_domains) {
allow_cookies.push(domain);
blockedRegexes[domain] = /cdn\.ampproject\.org\/v\d\/amp-(access|ad|subscriptions)-.+\.js/;
@ -851,6 +855,18 @@ ext_api.webRequest.onBeforeSendHeaders.addListener(function (details) {
},
["blocking", "requestHeaders"]);
// economictimes redirect
ext_api.webRequest.onBeforeRequest.addListener(function (details) {
if (!isSiteEnabled(details)) {
return;
}
var updatedUrl = details.url.split('?')[0].replace('economictimes.indiatimes.com', 'm.economictimes.com');
return { redirectUrl: updatedUrl };
},
{urls:["*://economictimes.indiatimes.com/*?from=mdr"], types:["main_frame"]},
["blocking"]
);
// fix nytimes x-frame-options (hidden iframe content)
ext_api.webRequest.onHeadersReceived.addListener(function (details) {
if (!isSiteEnabled(details)) {

View file

@ -4,6 +4,7 @@ Changelog Bypass Paywalls Clean - Firefox
Post-release
Add MediaNama (India)
Fix-update Prensa Iberica
Fix-update The Economic Times (mobile/India)
* v2.2.1.0 (2021-05-16)
Add Las Provincias (Spain)

View file

@ -1723,6 +1723,37 @@ else if (matchDomain('discovermagazine.com')) {
}, 1000); // Delay (in milliseconds)
}
else if (matchDomain('economictimes.com')) {
window.setTimeout(function () {
let paywall = document.querySelector('div#blocker_layer');
let data_prime = document.querySelector('div[data-prime="1"]');
if (paywall || data_prime) {
removeDOMElement(paywall);
if (data_prime)
data_prime.removeAttribute('data-prime');
let content = document.querySelector('div[id^="articlebody_"]');
if (content && content.classList.contains('paywall')) {
content.classList.remove('paywall');
window.location.reload(true);
}
let full_text = document.querySelector('div.paywall:not([id])');
if (content && full_text) {
content.innerText = '';
let parser = new DOMParser();
html = parser.parseFromString('<div>' + full_text.innerHTML + '</div>', 'text/html');
let article = html.querySelector('div');
content.appendChild(article);
removeDOMElement(full_text);
let data_adaptive = document.querySelector('div[data-adaptive="1"]');
if (data_adaptive)
data_adaptive.removeAttribute('data-adaptive');
let prime_banner = document.querySelector('div.q0AQz');
removeDOMElement(prime_banner);
}
}
}, 500); // Delay (in milliseconds)
}
else if (matchDomain('economictimes.indiatimes.com')) {
let paywall = document.querySelector('section.prime_paywall');
if (paywall) {
@ -1731,6 +1762,9 @@ else if (matchDomain('economictimes.indiatimes.com')) {
let full_text = document.querySelector('div.paywall.p1');
if (content && full_text)
content.innerText = full_text.innerText;
let page_content = document.querySelector('div.pageContent:not([style]');
if (page_content)
page_content.setAttribute('style', 'height: auto !important;');
}
}

View file

@ -130,6 +130,7 @@
"*://*.dn.se/*",
"*://*.dna.fr/*",
"*://*.dvhn.nl/*",
"*://*.economictimes.com/*",
"*://*.economictimes.indiatimes.com/*",
"*://*.economist.com/*",
"*://*.ed.nl/*",
@ -516,5 +517,5 @@
"*://*.wallkit.net/*",
"*://*.wsj.net/*"
],
"version": "2.2.1.2"
"version": "2.2.1.3"
}

View file

@ -247,7 +247,7 @@ var defaultSites =
"The Dallas Morning News": "dallasnews.com",
"The Denver Post": "denverpost.com",
"The Diplomat": "thediplomat.com",
"The Economic Times (ET Prime)": "economictimes.indiatimes.com",
"The Economic Times (ET Prime)": "###_economictimes",
"The Economist": "economist.com",
"The Globe and Mail": "theglobeandmail.com",
"The Hill Times": "hilltimes.com",
@ -326,6 +326,7 @@ const au_prov_news_domains = ['news-mail.com.au', 'frasercoastchronicle.com.au',
const ca_torstar_domains = ['niagarafallsreview.ca', 'stcatharinesstandard.ca', 'thepeterboroughexaminer.com', 'therecord.com', 'thespec.com', 'thestar.com', 'wellandtribune.ca'];
const de_funke_media_domains = ['abendblatt.de', 'braunschweiger-zeitung.de', 'morgenpost.de', 'nrz.de', 'otz.de', 'thueringer-allgemeine.de', 'tlz.de', 'waz.de', 'wp.de', 'wr.de'];
const de_madsack_domains = ['haz.de', 'kn-online.de', 'ln-online.de', 'lvz.de', 'maz-online.de', 'neuepresse.de', 'ostsee-zeitung.de'];
const economictimes_domains = ['economictimes.com', 'economictimes.indiatimes.com'];
const es_grupo_vocento_domains = ['diariosur.es', 'diariovasco.com', 'elcomercio.es', 'elcorreo.com', 'eldiariomontanes.es', 'elnortedecastilla.es', 'hoy.es', 'ideal.es', 'larioja.com', 'lasprovincias.es', 'laverdad.es', 'lavozdigital.es'];
const fi_alma_talent_domains = ['arvopaperi.fi', 'kauppalehti.fi', 'marmai.fi', 'mediuutiset.fi', 'mikrobitti.fi', 'talouselama.fi', 'tekniikkatalous.fi', 'tivi.fi', 'uusisuomi.fi'];
const fr_be_groupe_rossel_domains = ['aisnenouvelle.fr', 'courrier-picard.fr', 'lardennais.fr', 'lavoixdunord.fr', 'lecho.be', 'lesoir.be', 'lest-eclair.fr', 'liberation-champagne.fr', 'lunion.fr', 'nordeclair.fr', 'paris-normandie.fr', 'sudinfo.be'];
@ -340,4 +341,4 @@ const usa_tribune_domains = ['baltimoresun.com', 'chicagotribune.com', 'courant.
const usa_theathletic_domains = ['theathletic.com', 'theathletic.co.uk'];
var defaultSites_grouped_domains = Object.values(defaultSites);
var defaultSites_domains = defaultSites_grouped_domains.concat(au_comm_media_domains, au_news_corp_domains, au_prov_news_domains, ca_torstar_domains, de_funke_media_domains, de_madsack_domains, es_grupo_vocento_domains, fi_alma_talent_domains, fr_be_groupe_rossel_domains, fr_groupe_ebra_domains, fr_groupe_la_depeche_domains, it_ilmessaggero_domains, nl_ad_region_domains, timesofindia_domains, usa_mcc_domains, usa_nymag_domains, usa_tribune_domains, usa_theathletic_domains);
var defaultSites_domains = defaultSites_grouped_domains.concat(au_comm_media_domains, au_news_corp_domains, au_prov_news_domains, ca_torstar_domains, de_funke_media_domains, de_madsack_domains, economictimes_domains, es_grupo_vocento_domains, fi_alma_talent_domains, fr_be_groupe_rossel_domains, fr_groupe_ebra_domains, fr_groupe_la_depeche_domains, it_ilmessaggero_domains, nl_ad_region_domains, timesofindia_domains, usa_mcc_domains, usa_nymag_domains, usa_tribune_domains, usa_theathletic_domains);