diff --git a/changelog.txt b/changelog.txt index d354862..7becdb9 100644 --- a/changelog.txt +++ b/changelog.txt @@ -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) diff --git a/contentScript.js b/contentScript.js index f3f9ff7..37189d6 100644 --- a/contentScript.js +++ b/contentScript.js @@ -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('')[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; diff --git a/version.js b/version.js index e1a98e8..eb0fc92 100644 --- a/version.js +++ b/version.js @@ -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 => {