Fix Humanite.fr

This commit is contained in:
magnolia1234 2024-03-29 12:38:44 +01:00
parent 3db6d921c7
commit 759af025dc
3 changed files with 12 additions and 22 deletions

View file

@ -6,6 +6,7 @@ Post-release
Add American Purpose Add American Purpose
Add Ringier Axel Springer Polska Add Ringier Axel Springer Polska
Remove Hbvl.be (fix obsolete) Remove Hbvl.be (fix obsolete)
Fix Humanite.fr
Fix LeMonde.fr (bug; update rules) Fix LeMonde.fr (bug; update rules)
Fix WSJ (intro video) Fix WSJ (intro video)
Update custom sites (search) Update custom sites (search)

View file

@ -1944,28 +1944,10 @@ else if (matchDomain(fr_groupe_nice_matin_domains)) {
else if (matchDomain('humanite.fr')) { else if (matchDomain('humanite.fr')) {
let paywall = document.querySelector('div.single__categories svg'); let paywall = document.querySelector('div.single__categories svg');
if (paywall && dompurify_loaded) { if (paywall && dompurify_loaded) {
let json_script = document.querySelector('script[id="module-sage-index.js-js-extra"]'); csDoneOnce = true;
if (json_script) { let url = window.location.href;
csDoneOnce = true; let url_cache = 'https://webcache.googleusercontent.com/search?q=cache:' + url.split(/[#\?]/)[0];
if (json_script.text.match(/js_vars\s?=\s?/)) { replaceDomElementExt(url_cache, true, false, 'div.rich-text > div.gs-row');
try {
let json = JSON.parse(json_script.text.split(/js_vars\s?=\s?/)[1].split('};')[0] + '}');
let json_text = json.post.post_content.split('<!-- /wp:huma/featured-media -->')[1];
let article = document.querySelector('div.rich-text > div.gs-row');
if (article) {
let parser = new DOMParser();
let doc = parser.parseFromString('<div>' + DOMPurify.sanitize(json_text, dompurify_options) + '</div>', 'text/html');
let article_new = doc.querySelector('div');
if (article_new) {
article.innerHTML = '';
article.appendChild(article_new);
}
}
} catch (err) {
console.log(err);
}
}
}
} }
} }

View file

@ -71,6 +71,13 @@
"nofix": 1, "nofix": 1,
"upd_version": "3.6.0.8" "upd_version": "3.6.0.8"
}, },
"L'Humanité": {
"domain": "humanite.fr",
"allow_cookies": 1,
"block_regex": "\\.qiota\\.com",
"ld_google_webcache": "div.single__categories svg|div.rich-text > div.gs-row",
"upd_version": "3.6.1.5"
},
"Le Monde (link to archive.is)": { "Le Monde (link to archive.is)": {
"domain": "lemonde.fr", "domain": "lemonde.fr",
"allow_cookies": 1, "allow_cookies": 1,