Add The American Conservative

Fix mobile user-agent for Google webcache (proper)
merge-requests/16/head
magnolia1234 10 months ago
parent df725987f1
commit f1f3ec4440

@ -203,6 +203,7 @@ Grouped in options:\
[Slate](https://slate.com) -
[SofRep](https://sofrep.com) -
[Stereogum](https://www.stereogum.com) -
[The American Conservative](https://www.theamericanconservative.com) -
[The American Interest](https://www.the-american-interest.com) -
[The Art Newspaper](https://www.theartnewspaper.com) -
[The Atlantic](https://www.theatlantic.com) -

@ -122,10 +122,10 @@ function initSetRules() {
}
const userAgentDesktopG = "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)";
const userAgentMobileG = "Chrome/80.0.3987.92 Mobile Safari/537.36 (compatible ; Googlebot/2.1 ; +http://www.google.com/bot.html)";
const userAgentMobileG = "Chrome/115.0.5790.171 Mobile Safari/537.36 (compatible ; Googlebot/2.1 ; +http://www.google.com/bot.html)";
const userAgentDesktopB = "Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)";
const userAgentMobileB = "Chrome/80.0.3987.92 Mobile Safari/537.36 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)";
const userAgentMobileB = "Chrome/115.0.5790.171 Mobile Safari/537.36 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)";
const userAgentDesktopF = 'facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)';
@ -626,7 +626,7 @@ ext_api.webRequest.onBeforeRequest.addListener(function (details) {
);
// m.faz.net set user-agent to mobile
const userAgentMobile = "Mozilla/5.0 (Linux; Android 12) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.53 Mobile Safari/537.36";
const userAgentMobile = "Mozilla/5.0 (Linux; Android 12) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.5790.171 Mobile Safari/537.36";
ext_api.webRequest.onBeforeSendHeaders.addListener(function (details) {
if (!isSiteEnabled(details)) {
return;
@ -647,7 +647,7 @@ ext_api.webRequest.onBeforeSendHeaders.addListener(function (details) {
["blocking", "requestHeaders"]);
// webcache.googleusercontent.com set user-agent to Chrome (on Firefox for Android)
if ((typeof browser !== 'object') && navigator_ua_mobile) {
if ((typeof browser === 'object') && navigator_ua_mobile) {
ext_api.webRequest.onBeforeSendHeaders.addListener(function (details) {
let headers = details.requestHeaders;
headers = headers.map(function (header) {

@ -4,12 +4,14 @@ Updates (install signed xpi-file): https://gitlab.com/magnolia1234/bypass-paywal
Post-release
Add 4 more Lee Enterprises Group sites
Add The American Conservative
Add The Week (UK & USA)
Remove The Hollywood Reporter (no paywall)
Fix Harvard Business Review (js)
Fix Stylist.co.uk (css)
Fix The Toronto Star (homepage)
Fix Times of India (css)
Fix mobile user-agent for Google webcache (proper)
* v3.2.8.0 (2023-08-06)
Add America's Test Kitchen

@ -304,7 +304,7 @@ if (ext_api.runtime) {
// Content workarounds/domain
if (matchDomain('medium.com') || matchDomain(medium_custom_domains) || document.querySelector('script[src*=".medium.com/"]')) {
if (matchDomain('medium.com') || matchDomain(medium_custom_domains) || (!matchDomain('webcache.googleusercontent.com') && document.querySelector('script[src*=".medium.com/"]'))) {
let url = window.location.href;
let paywall = document.querySelector('article.meteredContent');
if (paywall) {
@ -4510,6 +4510,44 @@ else if (matchDomain('the-american-interest.com')) {
removeDOMElement(counter);
}
else if (matchDomain('theamericanconservative.com')) {
let paywall = document.querySelector('section.c-blog-post__body--locked');
if (paywall && dompurify_loaded) {
paywall.classList.remove('c-blog-post__body--locked');
let json_url_dom = document.querySelector('link[rel="alternate"][type="application/json"][href]');
let json_url = json_url_dom.href;
fetch(json_url)
.then(response => {
if (response.ok) {
response.json().then(json => {
let json_text = json.content.rendered;
if (json_text.includes('<p class="has-drop-cap">')) {
let split = json_text.split(/(<p class="has-drop-cap">)/);
json_text = split[1] + split[2];
}
let content = document.querySelector('div.c-blog-post__content');
if (json_text && content) {
let parser = new DOMParser();
let doc = parser.parseFromString('<div>' + DOMPurify.sanitize(json_text) + '</div>', 'text/html');
let content_new = doc.querySelector('div');
content.innerHTML = '';
content.appendChild(content_new, content);
}
});
}
});
} else {
let img_dark = document.querySelector('div.c-hero-article__image-img.o-image');
if (img_dark)
img_dark.removeAttribute('class');
}
let modal = document.querySelector('div#emailsub-modal');
removeDOMElement(modal);
let noscroll = document.querySelector('body.modal-open');
if (noscroll)
noscroll.classList.remove('modal-open');
}
else if (matchDomain('theathletic.com')) {
if (!(window.location.search.match(/(\?|&)amp/) && !document.querySelector('link[rel="amphtml"]'))) {
function theathletic_func(node) {

@ -51,5 +51,5 @@
"webRequestBlocking",
"*://*/*"
],
"version": "3.2.8.5"
"version": "3.2.8.6"
}

@ -628,6 +628,7 @@
"*://*.theadvocate.com.au/*",
"*://*.theadvocate.com/*",
"*://*.theage.com.au/*",
"*://*.theamericanconservative.com/*",
"*://*.theartnewspaper.com/*",
"*://*.theathletic.com/*",
"*://*.theatlantic.com/*",
@ -781,5 +782,5 @@
"*://*.wyleex.com/*",
"*://webcache.googleusercontent.com/*"
],
"version": "3.2.8.5"
"version": "3.2.8.6"
}

@ -1977,6 +1977,11 @@ var defaultSites = {
allow_cookies: 1,
block_regex: "(\\.{domain}\\/script\\.js|\\.blueconic\\.net\\/|\\.com\\/shared-content\\/art\\/tncms\\/user\\/user\\.js|js\\.matheranalytics\\.com\\/)"
},
"The American Conservative": {
domain: "theamericanconservative.com",
allow_cookies: 1,
cs_dompurify: 1
},
"The American Interest": {
domain: "the-american-interest.com",
allow_cookies: 1

Loading…
Cancel
Save