Fix group Mediahuis Nederland Regional

This commit is contained in:
magnolia1234 2021-08-18 18:15:00 +02:00
parent f1e58b659b
commit 0283e6a2db
3 changed files with 9 additions and 12 deletions

View file

@ -2,8 +2,9 @@
Changelog Bypass Paywalls Clean - Firefox Changelog Bypass Paywalls Clean - Firefox
Post-release Post-release
Add AdAge & Automotive News (& fix group Crain Communications) Add Ad Age & Automotive News (& fix group Crain Communications)
Add MediaNews Group (local USA) Add MediaNews Group (local USA)
Fix group Mediahuis Nederland Regional
Fix The Daily Beast (proper) Fix The Daily Beast (proper)
* v2.3.3.0 (2021-08-15) * v2.3.3.0 (2021-08-15)

View file

@ -1273,15 +1273,11 @@ else if (matchDomain(nl_mediahuis_region_domains)) {
if (paywall && auth_body) { if (paywall && auth_body) {
let auth_body_par_count = auth_body.querySelectorAll('p'); let auth_body_par_count = auth_body.querySelectorAll('p');
if (auth_body_par_count.length < 2) { if (auth_body_par_count.length < 2) {
let url = window.location.href; let json_script = document.querySelector('script[data-fragment-type="PacoArticleContent"]');
let html = document.documentElement.outerHTML; let json_str = json_script.text.substring(json_script.textContent.indexOf('{'));
let split1 = html.split('window["__PRELOADED_STATE_GRAPH__')[1].split(/=(.+)/)[1];
let split2 = split1.split('</script>')[0].trim();
let split3 = split2.split('"body":')[1];
let state = split3.split('},"gal')[0] + '}';
try { try {
let data = JSON.parse(state); let json = JSON.parse(json_str);
let article = data.json; let article = Object.values(json)[0]['data']['article']['body'];
auth_body.innerHTML = ''; auth_body.innerHTML = '';
let par_html, par_dom, par_elem, par_div, par_key; let par_html, par_dom, par_elem, par_div, par_key;
let parser = new DOMParser(); 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_div.innerText += par[key].credit ? '\n' + par[key].credit : '';
par_elem.appendChild(par_div); par_elem.appendChild(par_div);
} else { } else {
par_html = parser.parseFromString('<div>' + DOMPurify.sanitize(par_key) + '</div>', 'text/html'); par_html = parser.parseFromString('<p style="font-size: 18px; line-height: 1.625;">' + DOMPurify.sanitize(par_key) + '</div>', 'text/html');
par_elem = par_html.querySelector('div'); par_elem = par_html.querySelector('p');
} }
if (par_elem) if (par_elem)
par_dom.appendChild(par_elem); par_dom.appendChild(par_elem);

View file

@ -553,5 +553,5 @@
"*://*.wallkit.net/*", "*://*.wallkit.net/*",
"*://*.wsj.net/*" "*://*.wsj.net/*"
], ],
"version": "2.3.3.3" "version": "2.3.3.4"
} }