mirror of
https://github.com/iamadamdev/bypass-paywalls-chrome
synced 2025-05-09 09:14:27 +02:00
Fix barrons.com and wapo.com
This commit is contained in:
parent
586e48d65b
commit
9370072a21
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
const restrictions = {
|
const restrictions = {
|
||||||
'adweek.com': /^((?!\.adweek\.com\/(.+\/)?(amp|agencyspy|tvnewser|tvspy)\/).)*$/,
|
'adweek.com': /^((?!\.adweek\.com\/(.+\/)?(amp|agencyspy|tvnewser|tvspy)\/).)*$/,
|
||||||
'barrons.com': /.+barrons\.com\/(amp\/)?article(s)?\/.+/,
|
'barrons.com': /.+\.barrons\.com\/(amp\/)?article(s)?\/.+/,
|
||||||
'economist.com': /.+economist\.com\/.+\/\d{1,4}\/\d{1,2}\/\d{2}\/.+/,
|
'economist.com': /.+economist\.com\/.+\/\d{1,4}\/\d{1,2}\/\d{2}\/.+/,
|
||||||
'seekingalpha.com': /.+seekingalpha\.com\/article\/.+/,
|
'seekingalpha.com': /.+seekingalpha\.com\/article\/.+/,
|
||||||
'techinasia.com': /\.techinasia\.com\/.+/,
|
'techinasia.com': /\.techinasia\.com\/.+/,
|
||||||
@ -62,7 +62,6 @@ const allowCookies = [
|
|||||||
'vn.nl',
|
'vn.nl',
|
||||||
'volkskrant.nl',
|
'volkskrant.nl',
|
||||||
'vulture.com',
|
'vulture.com',
|
||||||
'washingtonpost.com',
|
|
||||||
'nzz.ch',
|
'nzz.ch',
|
||||||
'handelsblatt.com',
|
'handelsblatt.com',
|
||||||
'thehindu.com',
|
'thehindu.com',
|
||||||
@ -179,8 +178,7 @@ const useGoogleBotSites = [
|
|||||||
'df.cl',
|
'df.cl',
|
||||||
'ft.com',
|
'ft.com',
|
||||||
'wired.com',
|
'wired.com',
|
||||||
'zeit.de',
|
'zeit.de'
|
||||||
'washingtonpost.com'
|
|
||||||
];
|
];
|
||||||
|
|
||||||
// Override User-Agent with Bingbot
|
// Override User-Agent with Bingbot
|
||||||
@ -244,8 +242,7 @@ const blockedRegexes = {
|
|||||||
'elpais.com': /(\.epimg\.net\/js\/.+\/(noticia|user)\.min\.js|\/elpais\.com\/arc\/subs\/p\.min\.js|cdn\.ampproject\.org\/v\d\/amp-(access|(sticky-)?ad|consent)-.+\.js)/,
|
'elpais.com': /(\.epimg\.net\/js\/.+\/(noticia|user)\.min\.js|\/elpais\.com\/arc\/subs\/p\.min\.js|cdn\.ampproject\.org\/v\d\/amp-(access|(sticky-)?ad|consent)-.+\.js)/,
|
||||||
'expansion.com': /cdn\.ampproject\.org\/v\d\/amp-(access|ad|consent)-.+\.js/,
|
'expansion.com': /cdn\.ampproject\.org\/v\d\/amp-(access|ad|consent)-.+\.js/,
|
||||||
'chicagobusiness.com': /(\.tinypass\.com\/|\.chicagobusiness\.com\/.+\/js\/js_.+\.js)/,
|
'chicagobusiness.com': /(\.tinypass\.com\/|\.chicagobusiness\.com\/.+\/js\/js_.+\.js)/,
|
||||||
'dailytelegraph.com.au': /cdn\.ampproject\.org\/v\d\/amp-(access|ad|consent)-.+\.js/,
|
'dailytelegraph.com.au': /cdn\.ampproject\.org\/v\d\/amp-(access|ad|consent)-.+\.js/
|
||||||
'washingtonpost.com': /cdn\.ampproject\.org\/.+\/v\d\/amp-((sticky-)?ad|subscriptions)-.+\.js/
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const userAgentDesktop = 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)';
|
const userAgentDesktop = 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)';
|
||||||
@ -364,7 +361,7 @@ extensionApi.webRequest.onBeforeSendHeaders.addListener(function (details) {
|
|||||||
return { cancel: true };
|
return { cancel: true };
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isSiteEnabled(details)) {
|
if (!isSiteEnabled(details) && !matchUrlDomain('cdn.ampproject.org', details.url)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -400,26 +400,30 @@ if (matchDomain('elmercurio.com')) {
|
|||||||
}
|
}
|
||||||
}, 500);
|
}, 500);
|
||||||
} else if (matchDomain('barrons.com')) {
|
} else if (matchDomain('barrons.com')) {
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
const url = window.location.href;
|
||||||
|
if (!url.includes('barrons.com/amp/')) {
|
||||||
const bodyContinuous = document.querySelector('body.is-continuous');
|
const bodyContinuous = document.querySelector('body.is-continuous');
|
||||||
const snippet = document.querySelector('meta[content="snippet"]');
|
const snippet = document.querySelector('meta[content="snippet"]');
|
||||||
if (bodyContinuous && snippet) {
|
if (bodyContinuous && snippet) {
|
||||||
window.location.href = window.location.href.replace('barrons.com', 'barrons.com/amp');
|
removeDOMElement(snippet);
|
||||||
|
window.location.href = url.replace('barrons.com', 'barrons.com/amp');
|
||||||
}
|
}
|
||||||
});
|
const signinLinks = document.querySelectorAll('a.primary-button--link[href*="target="]');
|
||||||
if (!window.location.href.includes('barrons.com/amp/')) {
|
|
||||||
let href = '';
|
|
||||||
const signinLinks = document.querySelectorAll('a.primary-button--link');
|
|
||||||
for (const signinLink of signinLinks) {
|
for (const signinLink of signinLinks) {
|
||||||
href = signinLink.href;
|
signinLink.href = decodeURIComponent(signinLink.href.split('target=')[1]).split('?')[0];
|
||||||
if (href.includes('target=')) {
|
|
||||||
href = href.split('target')[1].split('%3F')[0];
|
|
||||||
href = href.replace('=', '').replace('%3A', ':').replace(/%2F/g, '/');
|
|
||||||
signinLink.href = href;
|
|
||||||
signinLink.text = 'Click';
|
signinLink.text = 'Click';
|
||||||
}
|
}
|
||||||
|
const barronsAds = document.querySelectorAll('.barrons-body-ad-placement');
|
||||||
|
removeDOMElement(...barronsAds);
|
||||||
|
} else {
|
||||||
|
const preview = document.querySelector('section[subscriptions-section="content-not-granted"]');
|
||||||
|
removeDOMElement(preview);
|
||||||
|
const subscrSection = document.querySelector('section[subscriptions-section="content"]');
|
||||||
|
if (subscrSection) {
|
||||||
|
subscrSection.removeAttribute('subscriptions-section');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
removeDOMElement(document.querySelector('.login-section-container'));
|
||||||
} else if (matchDomain('nzz.ch')) {
|
} else if (matchDomain('nzz.ch')) {
|
||||||
const paywall = document.querySelector('.dynamic-regwall');
|
const paywall = document.querySelector('.dynamic-regwall');
|
||||||
removeDOMElement(paywall);
|
removeDOMElement(paywall);
|
||||||
@ -756,13 +760,6 @@ function removeClassesByPrefix (el, prefix) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function pageContains (selector, text) {
|
|
||||||
const elements = document.querySelectorAll(selector);
|
|
||||||
return Array.prototype.filter.call(elements, function (element) {
|
|
||||||
return RegExp(text).test(element.textContent);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Prevent element from being added the first time to the DOM
|
// Prevent element from being added the first time to the DOM
|
||||||
function blockElement (selector, blockAlways = false) {
|
function blockElement (selector, blockAlways = false) {
|
||||||
new window.MutationObserver(function (mutations) {
|
new window.MutationObserver(function (mutations) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user