diff --git a/README.md b/README.md index 1c4c68c..a5ba479 100644 --- a/README.md +++ b/README.md @@ -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) - diff --git a/background.js b/background.js index c00ee7f..4727240 100644 --- a/background.js +++ b/background.js @@ -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; + } + }) }); } } diff --git a/changelog.txt b/changelog.txt index f503b7d..d9a5677 100644 --- a/changelog.txt +++ b/changelog.txt @@ -2,6 +2,7 @@ Changelog Bypass Paywalls Clean - Firefox Post-release +Add Lequipe.fr Add LaLibre.be Add LeVif.be Add Vrij Nederland diff --git a/contentScript.js b/contentScript.js index 1a1f259..9e53826 100644 --- a/contentScript.js +++ b/contentScript.js @@ -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 = '' + par_split_title[1] + '

' + par; + } + par = par.replace(/\\u003C/g, '<').replace(/\\u003E/g, '>').replace(/\\u002F/g, '/').replace(/\\"/g, '"').replace(/^\"|\"$/g, ''); + article_text += '

' + par + '

'; + } + } + } + article_dom = parser.parseFromString('
' + DOMPurify.sanitize(article_text) + '
', '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"]'); diff --git a/manifest.json b/manifest.json index a3db7b7..f68deab 100644 --- a/manifest.json +++ b/manifest.json @@ -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" } diff --git a/sites.js b/sites.js index bf49ce4..3d0ac51 100644 --- a/sites.js +++ b/sites.js @@ -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,