diff --git a/changelog.txt b/changelog.txt index 14c41e4..57fdf3a 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,8 +2,9 @@ Changelog Bypass Paywalls Clean - Firefox Post-release -Add AdAge & Automotive News (& fix group Crain Communications) +Add Ad Age & Automotive News (& fix group Crain Communications) Add MediaNews Group (local USA) +Fix group Mediahuis Nederland Regional Fix The Daily Beast (proper) * v2.3.3.0 (2021-08-15) diff --git a/contentScript.js b/contentScript.js index f160f54..1e9bc67 100644 --- a/contentScript.js +++ b/contentScript.js @@ -1273,15 +1273,11 @@ else if (matchDomain(nl_mediahuis_region_domains)) { if (paywall && auth_body) { let auth_body_par_count = auth_body.querySelectorAll('p'); if (auth_body_par_count.length < 2) { - let url = window.location.href; - let html = document.documentElement.outerHTML; - let split1 = html.split('window["__PRELOADED_STATE_GRAPH__')[1].split(/=(.+)/)[1]; - let split2 = split1.split('')[0].trim(); - let split3 = split2.split('"body":')[1]; - let state = split3.split('},"gal')[0] + '}'; + let json_script = document.querySelector('script[data-fragment-type="PacoArticleContent"]'); + let json_str = json_script.text.substring(json_script.textContent.indexOf('{')); try { - let data = JSON.parse(state); - let article = data.json; + let json = JSON.parse(json_str); + let article = Object.values(json)[0]['data']['article']['body']; auth_body.innerHTML = ''; let par_html, par_dom, par_elem, par_div, par_key; let parser = new DOMParser(); @@ -1329,8 +1325,8 @@ else if (matchDomain(nl_mediahuis_region_domains)) { par_div.innerText += par[key].credit ? '\n' + par[key].credit : ''; par_elem.appendChild(par_div); } else { - par_html = parser.parseFromString('
' + DOMPurify.sanitize(par_key) + '
', 'text/html'); - par_elem = par_html.querySelector('div'); + par_html = parser.parseFromString('

' + DOMPurify.sanitize(par_key) + '', 'text/html'); + par_elem = par_html.querySelector('p'); } if (par_elem) par_dom.appendChild(par_elem); diff --git a/manifest.json b/manifest.json index 7055793..028609d 100644 --- a/manifest.json +++ b/manifest.json @@ -553,5 +553,5 @@ "*://*.wallkit.net/*", "*://*.wsj.net/*" ], - "version": "2.3.3.3" + "version": "2.3.3.4" } \ No newline at end of file