mirror of
https://github.com/iamadamdev/bypass-paywalls-chrome
synced 2025-04-29 19:54:28 +02:00
Fix barrons.com and wapo.com
This commit is contained in:
parent
586e48d65b
commit
9370072a21
@ -2,7 +2,7 @@
|
||||
|
||||
const restrictions = {
|
||||
'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}\/.+/,
|
||||
'seekingalpha.com': /.+seekingalpha\.com\/article\/.+/,
|
||||
'techinasia.com': /\.techinasia\.com\/.+/,
|
||||
@ -62,7 +62,6 @@ const allowCookies = [
|
||||
'vn.nl',
|
||||
'volkskrant.nl',
|
||||
'vulture.com',
|
||||
'washingtonpost.com',
|
||||
'nzz.ch',
|
||||
'handelsblatt.com',
|
||||
'thehindu.com',
|
||||
@ -179,8 +178,7 @@ const useGoogleBotSites = [
|
||||
'df.cl',
|
||||
'ft.com',
|
||||
'wired.com',
|
||||
'zeit.de',
|
||||
'washingtonpost.com'
|
||||
'zeit.de'
|
||||
];
|
||||
|
||||
// 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)/,
|
||||
'expansion.com': /cdn\.ampproject\.org\/v\d\/amp-(access|ad|consent)-.+\.js/,
|
||||
'chicagobusiness.com': /(\.tinypass\.com\/|\.chicagobusiness\.com\/.+\/js\/js_.+\.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/
|
||||
'dailytelegraph.com.au': /cdn\.ampproject\.org\/v\d\/amp-(access|ad|consent)-.+\.js/
|
||||
};
|
||||
|
||||
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 };
|
||||
}
|
||||
|
||||
if (!isSiteEnabled(details)) {
|
||||
if (!isSiteEnabled(details) && !matchUrlDomain('cdn.ampproject.org', details.url)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -400,26 +400,30 @@ if (matchDomain('elmercurio.com')) {
|
||||
}
|
||||
}, 500);
|
||||
} 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 snippet = document.querySelector('meta[content="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');
|
||||
}
|
||||
});
|
||||
if (!window.location.href.includes('barrons.com/amp/')) {
|
||||
let href = '';
|
||||
const signinLinks = document.querySelectorAll('a.primary-button--link');
|
||||
const signinLinks = document.querySelectorAll('a.primary-button--link[href*="target="]');
|
||||
for (const signinLink of signinLinks) {
|
||||
href = signinLink.href;
|
||||
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.href = decodeURIComponent(signinLink.href.split('target=')[1]).split('?')[0];
|
||||
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')) {
|
||||
const paywall = document.querySelector('.dynamic-regwall');
|
||||
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
|
||||
function blockElement (selector, blockAlways = false) {
|
||||
new window.MutationObserver(function (mutations) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user