Fix Bloomberg (subscriber-only)

This commit is contained in:
magnolia1234 2021-12-12 22:24:54 +01:00
parent a1e49fe901
commit 34caf8796e
5 changed files with 25 additions and 5 deletions

View file

@ -19,7 +19,6 @@ const restrictions = {
'adweek.com': /^((?!\.adweek\.com\/(.+\/)?(amp|agencyspy|tvnewser|tvspy)\/).)*$/,
'barrons.com': /.+\.barrons\.com\/(amp\/)?article(s)?\/.+/,
'bloomberg.com': /^((?!\.bloomberg\.com\/news\/terminal\/).)*$/,
'bloombergquint.com': /^((?!\.bloombergquint\.com\/bq-blue-exclusive\/).)*$/,
'economictimes.com': /.+\.economictimes\.com\/($|(__assets|prime)(\/.+)?|.+\.cms)/,
'elespanol.com': /^((?!\/cronicaglobal\.elespanol\.com\/).)*$/,
'elpais.com': /(\/elpais\.com\/$|(static|imagenes(\.\w+)?)\.elpais\.com|\/(.+\.)?elpais\.com\/.+\.html)/,

View file

@ -5,6 +5,7 @@ Post-release
Add Koelner Stadt-Anzeiger & Koelnische Rundschau
Add The (New Orleans) Advocate
Remove Caixin Global (obsolete)
Fix Bloomberg (subscriber-only)
Fix Bloomberg Quint (bq blue)
Fix Inkl (images)
Fix Lecho.be (separate from Groupe Rossel)

View file

@ -1759,7 +1759,10 @@ else if (matchDomain('bloomberg.com')) {
if (json_script && dompurify_loaded) {
let json = JSON.parse(json_script.innerHTML);
if (json) {
let json_text = json.body ? json.body : '';
let json_text;
json_text = json.body ? json.body : '';
if (!json_text)
json_text = json.story.body ? json.story.body : '';
if (json_text) {
removeDOMElement(json_script);
let article = document.querySelector('div.body-copy-v2:not(.art_done)');
@ -1768,13 +1771,23 @@ else if (matchDomain('bloomberg.com')) {
article = document.querySelector('div.body-copy:not(.art_done)');
article_class = 'body-copy';
}
if (!article) {
article = document.querySelector('div.body-content:not(.art_done)');
article_class = 'body-content';
}
if (article) {
article_class += ' art_done';
let parser = new DOMParser();
let doc = parser.parseFromString('<div class="' + article_class + '">' + DOMPurify.sanitize(json_text, {ADD_TAGS: ['iframe', 'script']}) + '</div>', 'text/html');
let article_new = doc.querySelector('div');
if (article_new)
if (article_new) {
article.parentNode.replaceChild(article_new, article);
let teaser_body = document.querySelector('div.body-content[class*="teaser-content_"]');
removeDOMElement(teaser_body);
let body_transparent = document.querySelector('div[class*="nearly-transparent-text-blur_"]');
if (body_transparent)
removeClassesByPrefix(body_transparent, 'nearly-transparent-text-blur_');
}
}
}
}

View file

@ -188,7 +188,7 @@ var defaultSites = {
},
"Bloomberg": {
domain: "bloomberg.com",
block_regex: /\.tinypass\.com\//,
block_regex: /(\.tinypass\.com\/|assets\.bwbx\.io\/s\d\/fence\/(plug|fortress)-client\/)/,
remove_cookies_select_hold: ["bb_geo_info"]
},
"Bloomberg Quint": {

View file

@ -2,6 +2,7 @@
"Artnet": {
"domain": "artnet.com",
"allow_cookies": 1,
"amp_unhide": 1,
"block_regex": "\\.artnet\\.com\\/paywall-ajax\\.php",
"cs_code": [{
"cond": ".article-body",
@ -9,6 +10,11 @@
}
]
},
"Bloomberg": {
"domain": "bloomberg.com",
"block_regex": "(\\.tinypass\\.com\\/|assets\\.bwbx\\.io\\/s\\d\\/fence\\/(plug|fortress)-client\\/)",
"remove_cookies_select_hold": ["bb_geo_info"]
},
"Gannett Group (local USA Today)": {
"domain": "###_usa_gannett",
"group": [
@ -31,7 +37,7 @@
"Internazionale.it": {
"domain": "internazionale.it",
"allow_cookies": 1,
"block_regex": "\\.internazionale\\.it\\/assets\\/js\\/main\\.\\d{2,}\\.js"
"block_regex": "\\.internazionale\\.it\\/assets\\/js\\/main\\.\\d{2,}\\.js"
},
"The (New Orleans) Advocate": {
"domain": "###_usa_theadvocate",
@ -45,6 +51,7 @@
"The Boston Globe": {
"domain": "bostonglobe.com",
"allow_cookies": 1,
"amp_unhide": 1,
"block_regex": "(\\.blueconic\\.net\\/|meter\\.bostonglobe\\.com\\/js\\/)"
},
"The Business of Fashion": {