From 50ce1b99f553989e8c5900d48b27256a0bc820f8 Mon Sep 17 00:00:00 2001 From: magnolia1234 <7676006-magnolia1234@users.noreply.gitlab.com> Date: Tue, 17 Aug 2021 18:37:06 +0200 Subject: [PATCH] Fix The Daily Beast (proper) --- README.md | 82 +++++++++++++++++++++++++----------------------- background.js | 1 + changelog.txt | 1 + contentScript.js | 45 ++++++++++++++------------ manifest.json | 2 +- 5 files changed, 71 insertions(+), 60 deletions(-) diff --git a/README.md b/README.md index 5ff7544..e9a299c 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,10 @@ Then you need the 'custom' add-on version (with access to all sites): [Bypass Pa #### Chrome/Chromium Visit the [Chrome repository](https://gitlab.com/magnolia1234/bypass-paywalls-chrome-clean) of Bypass Paywall Clean. +#### Notes +* This add-on works best alongside the adblocker [uBlock Origin](https://addons.mozilla.org/en-US/firefox/addon/ublock-origin/). +* You will be logged out for most of the sites you have checked. + ### List of supported websites _* free articles only._ @@ -151,8 +155,8 @@ NHST Media Group sites like [New York Magazine](https://www.nymag.com) (+ [Curbed](https://www.curbed.com/), [Grub Street](https://www.grubstreet.com), [The Cut](https://www.thecut.com) & [Vulture](https://www.vulture.com)) - [Newsday](https://www.newsday.com) - [Palo Alto Online](https://www.paloaltoonline.com) - -[Pittsburgh Post Gazette](https://post-gazette.com) - -[San Diego Union Tribune](https://sandiegouniontribune.com) - +[Pittsburgh Post Gazette](https://www.post-gazette.com) - +[San Diego Union Tribune](https://www.sandiegouniontribune.com) - [San Francisco Chronicle](https://www.sfchronicle.com) - [Star Tribune](https://www.startribune.com) - [The Atlanta Journal-Constitution](https://www.ajc.com) - @@ -164,7 +168,7 @@ NHST Media Group sites like [USA Today](https://www.usatoday.com)\ Grouped in options:\ -*Gannett Group (local USA Today)* sites like (opt-in to custom sites) +*Gannett Group (local USA Today)* sites like (opt-in to custom sites)\ [Detroit Free Press](https://www.freep.com) - [Milwaukee Journal Sentinel](https://www.jsonline.com) - [The Indianapolis Star](https://www.indystar.com) - @@ -174,7 +178,7 @@ Grouped in options:\ [Crain's Cleveland Business](https://www.crainscleveland.com) - [Crain's Detroit Business](https://www.crainsdetroit.com) - [Crain's New York Business](https://www.crainsnewyork.com)\ -*McClatchy Group* sites like (opt-in to custom sites for unlisted) +*McClatchy Group* sites like (opt-in to custom sites for unlisted)\ [Belleville News-Democrat](https://www.bnd.com) - [Fort Worth Star-Telegram](https://www.star-telegram.com) - [Lexington Herald-Leader](https://www.kentucky.com) - @@ -187,14 +191,14 @@ Grouped in options:\ [The State](https://www.thestate.com) - [The Wichita Eagle](https://www.kansas.com) - [Tri-City Herald](https://www.tri-cityherald.com)\ -*MediaNews Group* sites like (opt-in to custom sites for unlisted/local sites): +*MediaNews Group* sites like (opt-in to custom sites for unlisted/local sites)\ [East Bay Times](https://www.eastbaytimes.com) - [Orange County Register](https://www.ocregister.com) - [St. Paul Pioneer Press](https://www.twincities.com) - [The Denver Post](https://www.denverpost.com) - [The Mercury News](https://www.mercurynews.com) - [The Press-Enterprise](https://www.pe.com)\ -*Tribune Publishing Company* sites like +*Tribune Publishing Company* sites like\ [Baltimore Sun](https://www.baltimoresun.com) - [Chicago Tribune](https://www.chicagotribune.com) - [Daily Press](https://www.dailypress.com) - @@ -247,14 +251,13 @@ Grouped in options:\ ##### Finland Grouped in options:\ -Sanoma Media Finland sites like +*Sanoma Media Finland* sites like (opt-in to custom sites for unlisted/regional sites)\ [Aamulehti](https://www.aamulehti.fi) - [Helsingin Sanomat](https://www.hs.fi) -* opt-in to custom sites for unlisted/regional sites -Alma Talent sites like +*Alma Talent* sites like\ [Arvopaperi](https://www.arvopaperi.fi) - -[Iltalehti](https://www.iltalehti.fi/) - +[Iltalehti (Firefox-only)](https://www.iltalehti.fi/) - [Kauppalehti](https://www.kauppalehti.fi) - [Markkinointi & Mainonta](https://www.marmai.fi) - [Mediuutiset](https://www.mediuutiset.fi) - @@ -288,9 +291,10 @@ Alma Talent sites like [Science & Vie](https://www.science-et-vie.com) - [Sciences et Avenir](https://www.sciencesetavenir.fr) - [Sud Ouest](https://www.sudouest.fr) - -[Valeurs Actuelles](https://www.valeursactuelles.com)\ +[Valeurs Actuelles](https://www.valeursactuelles.com) + Grouped in options:\ -Groupe EBRA sites like +*Groupe EBRA* sites like\ [Dernières Nouvelles d'Alsace](https://www.dna.fr) - [L'Alsace](https://www.lalsace.fr) - [L'Est Républicain](https://www.estrepublicain.fr) - @@ -300,7 +304,7 @@ Groupe EBRA sites like [Le Progrès](https://www.leprogres.fr) - [Le Républicain Lorrain](https://www.republicain-lorrain.fr) - [Vosges Matin](https://www.vosgesmatin.fr)\ -Groupe La Dépêche sites like +*Groupe La Dépêche* sites like\ [Centre Presse](https://www.centrepresseaveyron.fr) - [L'Indépendant](https://www.lindependant.fr) - [La Dépêche du Midi](https://www.ladepeche.fr) - @@ -308,7 +312,7 @@ Groupe La Dépêche sites like [Le Petit Bleu d'Agen](https://www.petitbleu.fr) - [Midi Libre](https://www.midilibre.fr) - [Midi Olympique](https://www.midi-olympique.fr) -Groupe Rossel sites (grouped in options) like +*Groupe Rossel* sites like\ [L'Aisne nouvelle](https://www.aisnenouvelle.fr) - [L'Ardennais](https://www.lardennais.fr) - [L'Est-Éclair](https://www.lest-eclair.fr) - @@ -343,9 +347,10 @@ Groupe Rossel sites (grouped in options) like [Schleswig-Holsteinischer Zeitungsverlag](https://www.shz.de) - [Schweriner Volkszeitung](https://www.svz.de) - [Süddeutsche Zeitung](https://www.sueddeutsche.de) - -[WirtschaftsWoche](https://www.wiwo.de)\ +[WirtschaftsWoche](https://www.wiwo.de) + Grouped in options:\ -Funke Mediengruppe sites like +*Funke Mediengruppe* sites like\ [Berliner Morgenpost](https://www.morgenpost.de) - [Braunschweiger Zeitung](https://www.braunschweiger-zeitung.de) - [Hamburger Abendblatt](https://www.abendblatt.de) - @@ -356,7 +361,7 @@ Funke Mediengruppe sites like [Westdeutsche Allgemeine Zeitung](https://www.waz.de) - [Westfalenpost](https://www.wp.de) - [Westfälische Rundschau](https://www.wr.de)\ -Madsack Mediengruppe sites like (opt-in to custom sites for unlisted) +*Madsack Mediengruppe* sites like (opt-in to custom sites for unlisted)\ [Hannoversche Allgemeine Zeitung](https://www.haz.de) - [Kieler Nachrichten](https://www.kn-online.de) - [Leipziger Volkszeitung](https://www.lvz.de) - @@ -376,7 +381,8 @@ Madsack Mediengruppe sites like (opt-in to custom sites for unlisted) [La Repubblica](https://www.repubblica.it) - [La Stampa](https://www.lastampa.it) - [Le Scienze](https://www.lescienze.it) - -[LimesOnline (it/en)](https://www.limesonline.com)\ +[LimesOnline (it/en)](https://www.limesonline.com) + Grouped in options:\ [Il Messaggero](https://www.ilmessaggero.it) and regional sites like [Corriere Adriatico](https://www.corriereadriatico.it) - @@ -404,7 +410,8 @@ Grouped in options:\ [Parool](https://www.parool.nl) - [Telegraaf](https://www.telegraaf.nl) - [Trouw](https://www.trouw.nl) - -[Volkskrant](https://www.volkskrant.nl)\ +[Volkskrant](https://www.volkskrant.nl) + Grouped in options:\ [Algemeen Dagblad](https://www.ad.nl) and regional ADR sites like [BN DeStem](https://www.bndestem.nl) - @@ -414,7 +421,7 @@ Grouped in options:\ [PZC](https://www.pzc.nl) - [Stentor](https://www.destentor.nl) - [Tubantia](https://tubantia.nl)\ -Mediahuis Nederland Regional sites like +*Mediahuis Nederland Regional* sites like\ [Noordhollands Dagblad](https://www.noordhollandsdagblad.nl) - [Haarlems Dagblad](https://www.haarlemsdagblad.nl) - [Leidsch Dagblad](https://www.leidschdagblad.nl) - @@ -445,9 +452,10 @@ Mediahuis Nederland Regional sites like [La Vanguardia](https://www.lavanguardia.com) - [Levante-EMV](https://www.levante-emv.com) - [Marca](https://www.marca.com) - -[Política Exterior](https://www.politicaexterior.com)\ +[Política Exterior](https://www.politicaexterior.com) + Grouped in options:\ -Grupo Vocento (ABC) regional sites like +*Grupo Vocento* (ABC regional) sites like\ [Diario Vasco](https://www.diariovasco.com) - [El Comercio](https://www.elcomercio.es) - [El Correo](https://www.elcorreo.com) - @@ -478,7 +486,9 @@ Grupo Vocento (ABC) regional sites like #### Australia/New Zealand [Brisbane Times](https://www.brisbanetimes.com.au) - +[Eureka Report](https://www.eurekareport.com.au) - [Griffith Review](https://www.griffithreview.com) - +[Intelligent Investor](https://www.intelligentinvestor.com.au) - [New Zealand Herald](https://www.nzherald.co.nz) - [The Age](https://www.theage.com.au) - [The Australian Financial Review](https://www.afr.com) - @@ -488,7 +498,8 @@ Grupo Vocento (ABC) regional sites like [The West Australian (+ regional)](https://thewest.com.au) - [WAtoday](https://www.watoday.com.au) -##### > News Corp Australia (grouped in options) +Grouped in options:\ +*News Corp Australia* site like\ [Cairns Post](https://www.cairnspost.com.au) - [Geelong Advertiser](https://www.geelongadvertiser.com.au) - [Gold Coast Bulletin](https://www.goldcoastbulletin.com.au) - @@ -501,14 +512,8 @@ Grupo Vocento (ABC) regional sites like [The Daily Telegraph](https://www.dailytelegraph.com.au) - [The Mercury Tasmania](https://www.themercury.com.au) - [The Weekly Times](https://www.weeklytimesnow.com.au) - -[Townsville Bulletin](https://www.townsvillebulletin.com.au) - -##### > Financial - -[Eureka Report](https://www.eurekareport.com.au) - -[Intelligent Investor](https://www.intelligentinvestor.com.au) - -##### > Australian Community Media (daily, grouped in options) +[Townsville Bulletin](https://www.townsvillebulletin.com.au)\ +*Australian Community Media (daily)* sites like (add to custom sites for unlisted & block general paywall-script Piano)\ [Bendigo Advertiser](https://www.bendigoadvertiser.com.au) - [Central Western Daily](https://www.centralwesterndaily.com.au) - [Daily Liberal](https://www.dailyliberal.com.au) - @@ -523,10 +528,8 @@ Grupo Vocento (ABC) regional sites like [The Northern Daily Leader](https://www.northerndailyleader.com.au) - [The Port Macquarie News](https://www.portnews.com.au) - [The Standard](https://www.standard.net.au) - -[Western Advocate](https://www.westernadvocate.com.au) -* add to custom sites for unlisted & block general paywall-script Piano - -##### > Australian Provincial Newspapers (all, grouped in options) +[Western Advocate](https://www.westernadvocate.com.au)\ +*Australian Provincial Newspapers* site like (opt-in to custom sites for unlisted)\ [Bundaberg News Mail](https://www.news-mail.com.au) - [Fraser Coast Chronicle](https://www.frasercoastchronicle.com.au) - [Gladstone Observer](https://www.gladstoneobserver.com.au) - @@ -537,7 +540,6 @@ Grupo Vocento (ABC) regional sites like [The Gympie Times](https://www.gympietimes.com.au) - [The Queensland Times](https://www.qt.com.au) - [Warwick Daily News](https://www.warwickdailynews.com.au) -* opt-in to custom sites for unlisted #### East Asia [Asia Times](https://asiatimes.com) - @@ -613,9 +615,9 @@ For user with the limited permissions BPC-version this will only work for suppor If removing the cookies works you can also add the site as a custom site. ### New site requests -You can submit a request for a new website [here](https://gitlab.com/magnolia1234/bypass-paywalls-firefox-clean/-/issues). +You can [submit a request for a new website](https://gitlab.com/magnolia1234/bypass-paywalls-firefox-clean/-/issues). Please read the following instructions and share your results for a quicker process. -Remember to check the [previous requests](https://gitlab.com/magnolia1234/bypass-paywalls-firefox-clean/-/issues) before asking for a new website. +Remember to check the [previous requests](https://gitlab.com/magnolia1234/bypass-paywalls-firefox-clean/-/issues?scope=all&state=all) before asking for a new website. 1. Visit an article on the site you want to bypass the paywall for and copy the article title. 2. Open up a new incognito window (Ctrl+Shift+P) and paste the article title into Google. 3. Click on the same article from the Google search results page. Or you can: @@ -625,7 +627,7 @@ Remember to check the [previous requests](https://gitlab.com/magnolia1234/bypass ### Add custom site Add your own custom site (also for testing). Check 'Options'-link in popup-menu and go to custom sites. -\* by default BPC has limited permissions, but you can opt-in to enable custom sites (and also clear cookies for non-listed sites). You can also just request permissions for the custom sites you added yourself. +\* by default BPC has limited permissions, but you can opt-in to enable custom sites (and also clear cookies/block general paywall-scripts for non-listed sites). You can also just request permissions for the custom sites you added yourself. Make sure the (new) site is checked under Options (or check on/off-button). By default sites' cookies/local storage are removed after page loads (to bypass article limit). @@ -644,6 +646,8 @@ You can also exclude a specific domain which is grouped in options. * If a site doesn't work, try turning off uBlock and refreshing. * Make sure the (new) site is checked under Options. * You will be logged out for most of the sites you have checked. +* Make sure you're running the latest version of Bypass Paywalls Clean. +* If none of these work, you can [submit an issue](https://gitlab.com/magnolia1234/bypass-paywalls-firefox-clean/-/issues). * If you live in the EU, also consider installing the extension [I don't care about cookies](https://addons.mozilla.org/en-US/firefox/addon/i-dont-care-about-cookies) in order to remove cookie warnings (or add filter [Easylist Cookies](https://easylist-downloads.adblockplus.org/easylist-cookie.txt) | [I don't care about cookies custom filter](https://www.i-dont-care-about-cookies.eu/abp) to uBlock Origin). Some sites need to set a consent-cookie for (social) media. ### Changelog-releases diff --git a/background.js b/background.js index 11adf55..9f805ad 100644 --- a/background.js +++ b/background.js @@ -363,6 +363,7 @@ var blockedRegexes = { 'nytimes.com': /(meter-svc\.nytimes\.com\/meter\.js|mwcm\.nyt\.com\/.+\.js)/, 'observador.pt': /\.tinypass\.com\//, 'parismatch.com': /\.poool\.fr\//, + 'post-gazette.com': /(cdn\.cxense\.com\/|\.tinypass\.com\/)/, 'qz.com': /\.tinypass\.com\//, 'reuters.com': /\.reuters\.com\/(arc\/subs\/p\.min|pf\/resources\/dist\/reuters\/js\/index)\.js/, 'rollingstone.com': /cdn\.cxense\.com\//, diff --git a/changelog.txt b/changelog.txt index 8d48123..36cd716 100644 --- a/changelog.txt +++ b/changelog.txt @@ -3,6 +3,7 @@ Changelog Bypass Paywalls Clean - Firefox Post-release Add MediaNews Group (local USA) +Fix The Daily Beast (proper) * v2.3.3.0 (2021-08-15) Add Live Law (India) diff --git a/contentScript.js b/contentScript.js index 1b169ac..71736ee 100644 --- a/contentScript.js +++ b/contentScript.js @@ -17,8 +17,8 @@ var it_repubblica_domains = ['gelocal.it', 'ilsecoloxix.it', 'lanuovasardegna.it var it_quotidiano_domains = ['ilgiorno.it', 'ilrestodelcarlino.it', 'iltelegrafolivorno.it', 'lanazione.it', 'quotidiano.net']; var nl_mediahuis_region_domains = ['gooieneemlander.nl', 'haarlemsdagblad.nl', 'ijmuidercourant.nl', 'leidschdagblad.nl', 'noordhollandsdagblad.nl']; var no_nhst_media_domains = ['intrafish.com', 'rechargenews.com', 'tradewindsnews.com', 'upstreamonline.com']; -var usa_crainsbiz_domains = ['chicagobusiness.com', 'crainscleveland.com', 'crainsdetroit.com', 'crainsnewyork.com']; var timesofindia_domains = ['timesofindia.com', 'timesofindia.indiatimes.com']; +var usa_crainsbiz_domains = ['chicagobusiness.com', 'crainscleveland.com', 'crainsdetroit.com', 'crainsnewyork.com']; var usa_mcc_domains = ['bnd.com', 'charlotteobserver.com', 'fresnobee.com', 'kansas.com', 'kansascity.com', 'kentucky.com', 'miamiherald.com', 'newsobserver.com', 'sacbee.com', 'star-telegram.com', 'thestate.com', 'tri-cityherald.com']; var usa_mng_domains = ['denverpost.com', 'eastbaytimes.com', 'mercurynews.com', 'ocregister.com', 'pe.com', 'twincities.com']; var usa_tribune_domains = ['baltimoresun.com', 'chicagotribune.com', 'courant.com', 'dailypress.com', 'mcall.com', 'nydailynews.com', 'orlandosentinel.com', 'pilotonline.com', 'sun-sentinel.com']; @@ -382,11 +382,11 @@ else if (matchDomain('faz.net')) { .then(response => { if (response.ok) { response.text().then(html => { - var parser = new DOMParser(); - var doc = parser.parseFromString(html, 'text/html'); + let parser = new DOMParser(); + let doc = parser.parseFromString(html, 'text/html'); let json = doc.querySelector('script[id="schemaOrgJson"]'); if (json) { - var json_text = json.text.replace(/(\r|\n)/g, ''); + let json_text = json.text.replace(/(\r|\n)/g, ''); let split1 = json_text.split('"ArticleBody": "'); let split2 = split1[1].split('","author":'); if (split2[0].includes('"')) @@ -753,7 +753,7 @@ else if (matchDomain('politicaexterior.com')) { let article = document.querySelector('div.entry-content-text'); let json = document.querySelector('script[type="application/ld+json"]:not([class]'); if (json) { - var json_text = JSON.parse(json.text).description.replace(/&nbsp;/g, ''); + let json_text = JSON.parse(json.text).description.replace(/&nbsp;/g, ''); let article_new = document.createElement('div'); article_new.setAttribute('class', 'entry-content-text'); article_new.innerText = '\r\n' + json_text; @@ -1903,7 +1903,7 @@ else if (matchDomain('economist.com')) { } }, 600); // Delay (in milliseconds) let p_articles = document.querySelectorAll('p.article__body-text'); - var href; + let href; for (let p_article of p_articles) { let e_anchors = document.querySelectorAll('a'); href = ''; @@ -1951,7 +1951,7 @@ else if (matchDomain('foreignaffairs.com')) { elem.classList.add('loaded'); let hidden_images = document.querySelectorAll('img[src^="data:image/"]'); for (let hidden_image of hidden_images) { - var data_src = hidden_image.getAttribute('data-src'); + let data_src = hidden_image.getAttribute('data-src'); if (data_src) { hidden_image.setAttribute('src', data_src); hidden_image.removeAttribute('class'); @@ -2096,8 +2096,8 @@ else if (matchDomain('inkl.com')) { if (dive_deeper_summary_bodies) { for (let summary_body of dive_deeper_summary_bodies) { if (!summary_body.querySelector('a')) { - var ng_click = summary_body.getAttribute('ng-click').replace("showArticle('", '').replace("')", ''); - var weblink = document.createElement('a'); + let ng_click = summary_body.getAttribute('ng-click').replace("showArticle('", '').replace("')", ''); + let weblink = document.createElement('a'); weblink.text = 'open'; weblink.href = 'https://www.inkl.com/news/' + ng_click; summary_body.appendChild(weblink); @@ -2340,8 +2340,10 @@ else if (matchDomain('republic.ru')) { else if (matchDomain('sandiegouniontribune.com')) { - let metering_bottompanel = document.querySelector('metering-bottompanel'); - removeDOMElement(metering_bottompanel); + window.setTimeout(function () { + let metering_bottompanel = document.querySelector('metering-bottompanel'); + removeDOMElement(metering_bottompanel); + }, 500); // Delay (in milliseconds) } else if (matchDomain('scmp.com') && window.location.href.includes('/amp.')) { @@ -2523,7 +2525,10 @@ else if (matchDomain('thedailybeast.com')) { removeDOMElement(paywall); let json_script = document.querySelector('script[displayName="initialState"]'); if (json_script) { - let json_text = json_script.innerText.includes('"sections":') ? json_script.innerText.split('"sections":')[1].split('},"')[0] : ''; + let json_split = json_script.innerText.includes('"sections":') ? json_script.innerText.split('"sections":') : []; + let json_text; + if (json_split.length > 1) + json_text = json_split[json_split.length - 1].split('},"')[0]; if (json_text) { let pars = json_text.split('"').filter(function (value) { return (value.split('[').length < 3 && value.split(']').length < 3); @@ -2911,7 +2916,7 @@ function addDivBpcDone() { } function matchDomain(domains, hostname) { - var matched_domain = false; + let matched_domain = false; if (!hostname) hostname = window.location.hostname; if (typeof domains === 'string') @@ -2989,7 +2994,7 @@ function cookieExists(name) { } function setCookie(name, value, domain, path, days) { - var max_age = days * 24 * 60 * 60; + let max_age = days * 24 * 60 * 60; document.cookie = name + "=" + (value || "") + "; domain=" + domain + "; path=" + path + "; max-age=" + max_age; } @@ -3013,9 +3018,9 @@ function genHexString(len) { function makeRandomNumber(len) { let result = ''; - var characters = '123456789'; - var charactersLength = characters.length; - for (var i = 0; i < len; i++) + let characters = '123456789'; + let charactersLength = characters.length; + for (let i = 0; i < len; i++) result += characters.charAt(Math.floor(Math.random() * charactersLength)); return result; } @@ -3028,13 +3033,13 @@ function pageContains(selector, text) { } function parseHtmlEntities(encodedString) { - var translate_re = /&(nbsp|amp|quot|lt|gt|deg|hellip|laquo|raquo|ldquo|rdquo|lsquo|rsquo|mdash);/g; - var translate = {"nbsp": " ", "amp": "&", "quot": "\"", "lt": "<", "gt": ">", "deg": "°", "hellip": "…", + let translate_re = /&(nbsp|amp|quot|lt|gt|deg|hellip|laquo|raquo|ldquo|rdquo|lsquo|rsquo|mdash);/g; + let translate = {"nbsp": " ", "amp": "&", "quot": "\"", "lt": "<", "gt": ">", "deg": "°", "hellip": "…", "laquo": "«", "raquo": "»", "ldquo": "“", "rdquo": "”", "lsquo": "‘", "rsquo": "’", "mdash": "—"}; return encodedString.replace(translate_re, function (match, entity) { return translate[entity]; }).replace(/&#(\d+);/gi, function (match, numStr) { - var num = parseInt(numStr, 10); + let num = parseInt(numStr, 10); return String.fromCharCode(num); }); } diff --git a/manifest.json b/manifest.json index 191f06f..ca62e47 100644 --- a/manifest.json +++ b/manifest.json @@ -551,5 +551,5 @@ "*://*.wallkit.net/*", "*://*.wsj.net/*" ], - "version": "2.3.3.1" + "version": "2.3.3.2" } \ No newline at end of file