From bdf58ab50581bdeb420f0a074a23324be5b5a8ed Mon Sep 17 00:00:00 2001
From: magnolia1234 <7676006-magnolia1234@users.noreply.gitlab.com>
Date: Mon, 14 Feb 2022 21:25:11 +0100
Subject: [PATCH] Fix Lequipe.fr (json)
---
changelog.txt | 7 ++++---
contentScript.js | 42 +++++++++++++++++++++++++-----------------
manifest.json | 2 +-
sites.js | 4 ++--
sites_updated.json | 2 +-
5 files changed, 33 insertions(+), 24 deletions(-)
diff --git a/changelog.txt b/changelog.txt
index 2fbb7f8..bfb8817 100644
--- a/changelog.txt
+++ b/changelog.txt
@@ -2,6 +2,7 @@
Changelog Bypass Paywalls Clean - Firefox
Post-release
+Fix Lequipe.fr (json)
* v2.5.6.0 (2022-02-13)
Add Condé Nast magazines & Vogue Business
@@ -206,7 +207,7 @@ Update custom sites (block regex for default sites)
* v2.4.0.0 (2021-10-17)
Add Westfaelische Nachrichten (Germany)
-Remove Australian Provincial Newspapers (fix obsolete)
+Remove Australian Provincial Newspapers (obsolete)
Fix GElocal.it
Fix National Review
Fix Ruhr Nachrichten (amp)
@@ -275,7 +276,7 @@ Fix group Crain Communications
Add Ad Age & Automotive News (group Crain Communications)
Add MediaNews Group (local USA)
Add The Intercept
-Remove Slader (fix obsolete)
+Remove Slader (obsolete)
Fix group Mediahuis Nederland Regional
Fix Medium (timing)
Fix The Australian
@@ -353,7 +354,7 @@ Update custom sites (set useragent Bingbot)
* v2.2.6.0 (2021-06-20)
Add group Mediahuis Nederland Regional
-Remove The Northern Star (fix obsolete)
+Remove The Northern Star (obsolete)
Fix Atlantico.fr
Fix Boston Globe (no opt-in)
Fix Foreign Policy
diff --git a/contentScript.js b/contentScript.js
index 16b7990..0718720 100644
--- a/contentScript.js
+++ b/contentScript.js
@@ -1131,26 +1131,34 @@ else if (matchDomain('lequipe.fr')) {
if (par_type) {
article.innerHTML = '';
let json_split = json.split('__type:' + par_type);
- if (json_split.length < 5) {
- par_type = json.split('content:"')[1].split('"},{__type:')[1].split(',')[0];
- 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:')) {
- let content = par.split(',content:')[1].split('",')[0];
- let par_title = '';
- if (par.includes(',title:'))
- par_title = par.split(',title:')[1].split(',')[0].replace(/^\"|\"$/g, '');
- if (content) {
- par = content.replace('class=', '');
- if (par_title.length > 2)
- par = '' + par_title + '
' + content;
- par = par.replace(/\\u003C/g, '<').replace(/\\u003E/g, '>').replace(/\\u002F/g, '/').replace(/\\"/g, '"').replace(/^\"|\"$/g, '');
- article_text += '
' + par + '
'; + for (let par_main of json_split) { + if (par_main.includes(',content:')) { + if (par_main.split(',content:"').length > 2) { + if (par_main.startsWith(',title:')) + article_text += '' + par_main.split(',title:')[1].split(',')[0].replace(/^\"|\"$/g, '') + '
'; + par_type = json.split('content:')[1].split('"},{__type:')[1].split(',')[0]; + pars = par_main.split('__type:' + par_type); + } else { + pars = [par_main]; + } + for (let par of pars) { + par = par.split('}')[0]; + if (par.includes(',content:')) { + let content = par.split(',content:')[1].split('",')[0]; + let par_title = ''; + if (par.includes(',title:')) + par_title = par.split(',title:')[1].split(',')[0].replace(/^\"|\"$/g, ''); + if (content) { + par = content.replace('class=', ''); + if (par_title.length > 2) + par = '' + par_title + '' + par + '
'; + } + } } } } diff --git a/manifest.json b/manifest.json index 2814e5b..f4222c0 100644 --- a/manifest.json +++ b/manifest.json @@ -620,5 +620,5 @@ "*://*.wallkit.net/*", "*://*.wsj.net/*" ], - "version": "2.5.6.0" + "version": "2.5.6.1" } diff --git a/sites.js b/sites.js index 294cbcb..49ba1dc 100644 --- a/sites.js +++ b/sites.js @@ -647,7 +647,7 @@ var defaultSites = { allow_cookies: 1, block_regex: /(\.piano\.io\/|cdn\.cxense\.com\/|cdn\.ampproject\.org\/v\d\/amp-(access|analytics)-.+\.js)/ }, - "Grupo Vocento (Spain, regional daily)": { + "Grupo Vocento": { domain: "###_es_grupo_vocento", group: [ "diariosur.es", @@ -1626,7 +1626,7 @@ var defaultSites = { allow_cookies: 1, block_regex: /(\.tinypass\.com\/|\.telegraph\.co\.uk\/martech\/js\/|cdn\.ampproject\.org\/v\d\/amp-(access|(sticky-)?ad)-.+\.js)/ }, - "The Times": { + "The Times (UK)": { domain: "thetimes.co.uk", allow_cookies: 1, useragent: "googlebot" diff --git a/sites_updated.json b/sites_updated.json index ff02515..8c75d39 100644 --- a/sites_updated.json +++ b/sites_updated.json @@ -114,7 +114,7 @@ "block_regex": "(journey\\.vogue\\.com\\/build-.+\\.js|cdn\\.ampproject\\.org\\/v\\d\\/amp-(ad|subscriptions)-.+\\.js)", "useragent": "googlebot" }, - "Voguebusiness.com": { + "Vogue Business": { "allow_cookies": 1, "domain": "voguebusiness.com", "useragent": "googlebot"