Fix-update LesEchos.fr (json)

This commit is contained in:
magnolia1234 2020-11-25 19:39:46 +01:00
parent 955f19bafa
commit 6e8e471315
3 changed files with 9 additions and 3 deletions

View file

@ -7,6 +7,7 @@ Add Grupo Vocento (Spain, regional daily)
Add The Hindu BusinessLine (India)
Fix-update Corriere Della Sera (redirect preview)
Fix-update Faz.net (error in json)
Fix-update LesEchos.fr (json)
Fix popup (update notification & close error)
Update block general paywall script (Pelcro)
Update grouped sites (init rules)

View file

@ -680,9 +680,13 @@ else if (matchDomain("lesechos.fr") && window.location.href.match(/-\d{6,}/)) {
removeDOMElement(abo_banner);
let url = window.location.href;
let html = document.documentElement.outerHTML;
let split1 = html.split('window.__PRELOADED_STATE__')[1];
let state;
let split1 = html.split('window.__PRELOADED_STATE__=')[1];
let split2 = split1.split('</script>')[0].trim();
let state = split2.substr(1, split2.length - 2);
if (split2.includes('; window.__DATA__='))
state = split2.split('; window.__DATA__=')[0].trim();
else
state = split2.substr(0, split2.length - 1);
try {
let data = JSON.parse(state);
let article = data.article.data.stripes[0].mainContent[0].data.description;

View file

@ -4,8 +4,9 @@ var manifestData = ext_api.runtime.getManifest();
var versionString = 'v' + manifestData.version;
document.getElementById('version').innerText = versionString;
const proxyurl = "https://cors-anywhere.herokuapp.com/";
const manifest_new = 'https://gitlab.com/magnolia1234/bypass-paywalls-firefox-clean/-/raw/master/manifest.json';
fetch(manifest_new, { headers: { "Content-Type": "application/json", "X-Requested-With": "XMLHttpRequest" } })
fetch(proxyurl + manifest_new, { headers: { "Content-Type": "application/json", "X-Requested-With": "XMLHttpRequest" } })
.then(response => {
if (response.ok) {
response.json().then(json => {