Fix ESPN USA

This commit is contained in:
magnolia1234 2023-04-20 20:56:23 +02:00
parent 9f808dcf7c
commit a9c0fc5495
7 changed files with 42 additions and 8 deletions

View File

@ -215,7 +215,7 @@ function set_rules(sites, sites_updated, sites_custom) {
if (!custom) {
let isCustomSite = matchDomain(customSites_domains, domain);
let customSite_title = isCustomSite ? Object.keys(customSites).find(key => customSites[key].domain === isCustomSite) : '';
if (customSite_title) {
if (customSite_title && !rule.add_ext_link) {
// add default block_regex
let block_regex_default = '';
if (rule.hasOwnProperty('block_regex'))

View File

@ -3,6 +3,7 @@ Changelog Bypass Paywalls Clean - Firefox
Updates (install signed xpi-file): https://gitlab.com/magnolia1234/bypass-paywalls-firefox-clean/-/releases
Post-release
Fix ESPN USA
Fix Groupe IPM
Fix StuDocu (banner)

View File

@ -3379,9 +3379,7 @@ else if (matchDomain('espn.com')) {
let paywall = document.querySelector('aside.espn-plus-container-wrapper');
if (paywall) {
removeDOMElement(paywall);
let article = document.querySelector('div.article-body');
if (article)
article.firstChild.before(archiveLink(url));
replaceDomElementExt(url, false, false, 'div.article-body');
}
}
@ -4944,7 +4942,12 @@ function replaceDomElementExt(url, proxy, base64, selector, text_fail = '', sele
}
ext_api.runtime.sendMessage({request: 'getExtSrc', data: {url: url, selector: selector, selector_source: selector_source, base64: base64, text_fail: text_fail}});
} else {
fetch(url)
let options = {};
if (matchUrlDomain('espn.com', url))
options.headers = {
'X-Forwarded-For': randomIP(185, 185)
};
fetch(url, options)
.then(response => {
let article = document.querySelector(selector);
if (response.ok) {
@ -5161,6 +5164,21 @@ function makeRandomNumber(len) {
return result;
}
function randomInt(max) {
return Math.floor(Math.random() * Math.floor(max));
}
function randomIP(range_low = 0, range_high = 223) {
let rndmIP = [];
for (let n = 0; n < 4; n++) {
if (n === 0)
rndmIP.push(range_low + randomInt(range_high - range_low + 1));
else
rndmIP.push(randomInt(255) + 1);
}
return rndmIP.join('.');
}
function pageContains(selector, text) {
let elements = document.querySelectorAll(selector);
return Array.prototype.filter.call(elements, function (element) {

View File

@ -51,5 +51,5 @@
"webRequestBlocking",
"*://*/*"
],
"version": "3.1.4.3"
"version": "3.1.4.4"
}

View File

@ -118,6 +118,11 @@
"block_regex": "\\.tinypass\\.com",
"domain": "eluniversal.com.mx"
},
"Eviemagazine.com": {
"allow_cookies": 1,
"block_regex": "\\.eviemagazine\\.com\\/api\\/trpc\\/post\\.paywall",
"domain": "eviemagazine.com"
},
"Fastcompany.com": {
"allow_cookies": 1,
"block_regex": "\\.tinypass\\.com",
@ -437,6 +442,11 @@
"allow_cookies": 1,
"domain": "saechsische.de"
},
"Schwaebische-post.de": {
"allow_cookies": 1,
"block_regex": "\\.schwaebische-post\\.de\\/sub\\/js\\/pc-offer-west\\.js",
"domain": "schwaebische-post.de"
},
"Siliconrepublic.com": {
"allow_cookies": 1,
"block_regex": "js\\.pelcro\\.com",
@ -541,6 +551,11 @@
"block_regex": "\\.tinypass\\.com",
"domain": "thenational.scot"
},
"Thestage.co.uk": {
"allow_cookies": 1,
"domain": "thestage.co.uk",
"ld_google_webcache": "div#ao-MeteringDNAllow|div[id^='aos-FeatureArticle']"
},
"Theweek.com": {
"allow_cookies": 1,
"domain": "theweek.com",

View File

@ -754,5 +754,5 @@
"*://html.onlineviewer.net/*",
"*://webcache.googleusercontent.com/*"
],
"version": "3.1.4.3"
"version": "3.1.4.4"
}

View File

@ -510,7 +510,7 @@ var defaultSites = {
domain: "enotes.com",
allow_cookies: 1
},
"ESPN USA (news only; link to archive.is))": {
"ESPN USA (news only)": {
domain: "espn.com",
allow_cookies: 1
},