Skip to content
This repository has been archived by the owner on Jul 26, 2020. It is now read-only.

Commit

Permalink
v0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
nextgens committed Nov 25, 2017
0 parents commit 8dae5f1
Show file tree
Hide file tree
Showing 2 changed files with 110 additions and 0 deletions.
44 changes: 44 additions & 0 deletions background.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
function evadePaywalls(details) {
var reqHeaders = details.requestHeaders.filter(function(header) {
// drop cookies, referer and UA
if (header.name === "Cookie" || header.name === "Referer" || header.name === "User-Agent") {
return false;
}

return true;
})

// Add the spoofed ones back
reqHeaders.push({
"name": "Referer",
"value": "https://www.google.com/"
})
reqHeaders.push({
"name": "User-Agent",
"value": "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
})

return {requestHeaders: reqHeaders};
}

function blockCookies(details) {
var responseHeaders = details.responseHeaders.filter(function(header) {
if (header.name === "Cookie") {
return false;
}

return true;
})

return {responseHeaders: responseHeaders};
}

chrome.webRequest.onBeforeSendHeaders.addListener(evadePaywalls, {
urls: ["<all_urls>"],
types: ["main_frame"],
}, ["requestHeaders", "blocking"]);

chrome.webRequest.onHeadersReceived.addListener(blockCookies, {
urls: ["<all_urls>"],
types: ["main_frame"],
}, ["responseHeaders", "blocking"]);
66 changes: 66 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"name": "Anti-Paywall",
"version": "0.1",
"description": "This will prevent cookies from being stored, spoof the user-agent and mangle the referrer to maximize the chances of bypassing paywalls.",
"permissions": ["webRequest", "webRequestBlocking",
"*://*.adelaidenow.com.au/*",
"*://*.asia.nikkei.com/*",
"*://*.baltimoresun.com/*",
"*://*.barrons.com/*",
"*://*.bostonglobe.com/*",
"*://*.chicagobusiness.com/*",
"*://*.chicagotribune.com/*",
"*://*.courant.com/*",
"*://*.couriermail.com.au/*",
"*://*.cricketarchive.com/*",
"*://*.dailypress.com/*",
"*://*.economist.com/*",
"*://*.fd.nl/*",
"*://*.forbes.com/*",
"*://*.ft.com/*",
"*://*.geelongadvertiser.com.au/*",
"*://*.glassdoor.com/*",
"*://*.haaretz.co.il/*",
"*://*.haaretz.com/*",
"*://*.hbr.org/*",
"*://*.heraldsun.com.au/*",
"*://*.inc.com/*",
"*://*.independent.co.uk/*",
"*://*.investingdaily.com/*",
"*://*.irishtimes.com/*",
"*://*.latimes.com/*",
"*://*.letemps.ch/*",
"*://*.mcall.com/*",
"*://*.medscape.com/*",
"*://*.nationalpost.com/*",
"*://*.newsweek.com/*",
"*://*.newyorker.com/*",
"*://*.nnsl.com/*",
"*://*.nrc.nl/*",
"*://*.nytimes.com/*",
"*://*.ocregister.com/*",
"*://*.orlandosentinel.com/*",
"*://*.quora.com/*",
"*://*.scmp.com/*",
"*://*.seattletimes.com/*",
"*://*.smh.com.au/*",
"*://*.sun-sentinel.com/*",
"*://*.technologyreview.com/*",
"*://*.telegraph.co.uk/*",
"*://*.theage.com.au/*",
"*://*.theaustralian.com.au/*",
"*://*.theglobeandmail.com/*",
"*://*.thenation.com/*",
"*://*.thestreet.com/*",
"*://*.thesundaytimes.co.uk/*",
"*://*.thetimes.co.uk/*",
"*://*.volkskrant.nl/*",
"*://*.washingtonpost.com/*",
"*://*.wsj.com/*"
],
"background": {
"scripts": ["background.js"]
},
"manifest_version": 2
}

0 comments on commit 8dae5f1

Please sign in to comment.