This repository has been archived by the owner on Jul 26, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 8dae5f1
Showing
2 changed files
with
110 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
|