Fix LesEchos.fr (json)

This commit is contained in:
magnolia1234 2023-04-06 19:39:32 +02:00
parent 446df430f0
commit c520bee8f4
4 changed files with 26 additions and 30 deletions

View file

@ -4,6 +4,7 @@ Updates: https://gitlab.com/magnolia1234/bypass-paywalls-firefox-clean/-/release
Post-release
Add Haas Mediengruppe (opt-in to custom sites)
Fix LesEchos.fr (json)
* v3.1.2.0 (2023-04-02)
Add Epicurious (Conde Nast)

View file

@ -1567,22 +1567,16 @@ else if (matchDomain('lesechos.fr')) {
removeDOMElement(abo_banner);
let url = window.location.href;
let html = document.documentElement.outerHTML;
let state;
let split1 = html.split('window.__CONFIG__=')[1];
let split2 = split1.split('</script>')[0].trim();
if (split2.includes('window.__DATA__=')) {
state = split2.split('window.__DATA__=')[1].split('};')[0] + '}';
} else
state = split2.substr(0, split2.length - 1);
try {
let split1 = html.split(/window\.__REACT_QUERY_STATE__\s?=/)[1];
let state = split1.split('</script>')[0].trim().replace(/;$/, '');
let data = JSON.parse(state);
let data_article = data.article ? data.article : data.pageProps;
if (data_article.dehydratedState)
data_article = data_article.dehydratedState.queries[1].state;
let article = data_article.data.stripes[0].mainContent[0].data.description.replace(/allowfullscreen=''/g, '');
let data_article = data.queries[1].state;
let url_loaded = data_article.data.path;
if (url_loaded && !url.replace(/%20/g, '').includes(url_loaded))
if (url_loaded && (!url_loaded.slice(-7).match(/\d+/) || !url.includes(url_loaded.slice(-7))))
refreshCurrentTab();
else {
let article = data_article.data.stripes[0].mainContent[0].data.description.replace(/allowfullscreen='(true)?'/g, '');
let paywallNode = document.querySelector('.post-paywall');
if (paywallNode) {
let contentNode = document.createElement('div');
@ -1602,6 +1596,7 @@ else if (matchDomain('lesechos.fr')) {
}
let styleElem = document.head.appendChild(document.createElement('style'));
styleElem.innerHTML = ".post-paywall::after {height: auto !important;}";
}
} catch (err) {
console.log(err);
}

View file

@ -51,5 +51,5 @@
"webRequestBlocking",
"*://*/*"
],
"version": "3.1.2.1"
"version": "3.1.2.2"
}

View file

@ -748,5 +748,5 @@
"*://*.wallkit.net/*",
"*://webcache.googleusercontent.com/*"
],
"version": "3.1.2.1"
"version": "3.1.2.2"
}