Add Lequipe.fr

This commit is contained in:
magnolia1234 2021-12-17 21:22:10 +01:00
parent f791c11e5f
commit c4772a5af3
6 changed files with 73 additions and 9 deletions

View file

@ -313,6 +313,7 @@ Grouped in options:\
[Elle](https://www.elle.fr) -
[Esprit](https://esprit.presse.fr) -
[L'Écho](https://lecho.be) -
[L'Équipe](https://www.lequipe.fr) -
[L'Express](https://www.lexpress.fr) -
[L'Obs](https://www.nouvelobs.com) -
[L'Oeil de la Photographie (fr/en)](https://loeildelaphotographie.com) -

View file

@ -556,7 +556,7 @@ ext_api.webRequest.onBeforeRequest.addListener(function (details) {
// theaustralian.com redirect subscribe to amp
ext_api.webRequest.onBeforeRequest.addListener(function (details) {
if (!isSiteEnabled(details)) {
if (!isSiteEnabled(details) || details.url.includes('/digitalprinteditions')) {
return;
}
var updatedUrl = decodeURIComponent(details.url.split('dest=')[1].split('&')[0]).replace('www.', 'amp.');
@ -968,20 +968,29 @@ if (matchUrlDomain(change_headers, details.url) && !['font', 'image', 'styleshee
}
}
});
} else {//mercuriovalpo.cl
} else { //mercuriovalpo.cl, estrellavalpo.cl, lequipe.fr
ext_api.tabs.query({
active: true,
currentWindow: true
}, function (tabs) {
if (tabs && tabs[0] && tabs[0].url && tabs[0].url.startsWith('http')) {
if (isSiteEnabled({url: tabs[0].url})) {
let currentTab = tabs[0];
if (isSiteEnabled(currentTab)) {
let lib_file = 'lib/empty.js';
if (matchUrlDomain(['lequipe.fr'], currentTab.url))
lib_file = 'lib/purify.min.js';
ext_api.tabs.executeScript({
file: 'contentScript.js',
file: lib_file,
runAt: 'document_start'
}, function (res) {
if (ext_api.runtime.lastError || res[0]) {
return;
}
}, function () {
ext_api.tabs.executeScript({
file: 'contentScript.js',
runAt: 'document_start'
}, function (res) {
if (ext_api.runtime.lastError || res[0]) {
return;
}
})
});
}
}

View file

@ -2,6 +2,7 @@
Changelog Bypass Paywalls Clean - Firefox
Post-release
Add Lequipe.fr
Add LaLibre.be
Add LeVif.be
Add Vrij Nederland

View file

@ -963,6 +963,53 @@ else if (matchDomain(['lejdd.fr', 'parismatch.com'])) {
}
}
else if (matchDomain('lequipe.fr')) {
let paywall = document.querySelectorAll('.Paywall, .Article__paywall');
if (paywall) {
removeDOMElement(...paywall);
let scripts = document.querySelectorAll('script:not([src], [type])');
let json_script;
for (let script of scripts) {
if (script.innerText.includes('window.__NUXT__=')) {
json_script = script;
break;
}
}
let article = document.querySelector('div.article__body');
if (article && json_script && dompurify_loaded) {
if (json_script.innerText.includes('articleObject:')) {
let json = json_script.textContent.split('articleObject:')[1].split(',articleType')[0];
let par_type = json.split('paragraphs:[')[1].split(',{__type:')[1].split(',is_focus:')[0];
if (par_type) {
article.innerHTML = '';
let json_split = json.split('__type:' + par_type);
let article_dom;
let article_text = '';
let parser = new DOMParser();
for (let par of json_split) {
par = par.split('}')[0];
if (par.includes(',content:')) {
par = par.split(',content:')[1].split(',layout')[0];
if (par) {
if (par.includes(',title:')) {
let par_split_title = par.split(',title:').map(x => x.replace(/^\"|\"$/g, ''));
par = par_split_title[0];
if (par_split_title[1].length > 2)
par = '<strong>' + par_split_title[1] + '</strong><br><br>' + par;
}
par = par.replace(/\\u003C/g, '<').replace(/\\u003E/g, '>').replace(/\\u002F/g, '/').replace(/\\"/g, '"').replace(/^\"|\"$/g, '');
article_text += '<p>' + par + '</p>';
}
}
}
article_dom = parser.parseFromString('<div style="margin:20px; font-famile:"DINNextLTPro-Regular",sans-serif; fot-size:18px;">' + DOMPurify.sanitize(article_text) + '</div>', 'text/html');
article.appendChild(article_dom.querySelector('div'));
}
}
}
}
}
else if (matchDomain('lesechos.fr') && window.location.href.match(/-\d{6,}/)) {
window.setTimeout(function () {
let abo_banner = document.querySelector('div[class*="pgxf3b-2"]');

View file

@ -307,6 +307,7 @@
"*://*.lejsl.com/*",
"*://*.leparisien.fr/*",
"*://*.leprogres.fr/*",
"*://*.lequipe.fr/*",
"*://*.lescienze.it/*",
"*://*.lesechos.com/*",
"*://*.lesechos.fr/*",
@ -590,5 +591,5 @@
"*://*.wallkit.net/*",
"*://*.wsj.net/*"
],
"version": "2.4.7.4"
"version": "2.4.7.5"
}

View file

@ -760,6 +760,11 @@ var defaultSites = {
"L'Écho": {
domain: "lecho.be"
},
"L'Équipe": {
domain: "lequipe.fr",
allow_cookies: 1,
block_regex: /\.lequipe\.fr\/commons\/lequipe-paywall\/pagePaywall\.js/
},
"L'Express": {
domain: "lexpress.fr",
allow_cookies: 1,