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

Commit

Permalink
v0.3: Send the required cookies and set X-Forwarded-For
Browse files Browse the repository at this point in the history
  • Loading branch information
nextgens committed Nov 26, 2017
1 parent 0403901 commit 5f689df
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
18 changes: 18 additions & 0 deletions background.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
const cookies = ([
// theaustralian.com.au
'open_token=anonymous',
'sr=true',
'n_regis=123456789'
]).join('; ').trim()

function evadePaywalls(details) {
var reqHeaders = details.requestHeaders.filter(function(header) {
// drop cookies, referer and UA
Expand All @@ -18,6 +25,17 @@ function evadePaywalls(details) {
"value": "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
})

reqHeaders.push({
"name": "Cookie",
"value": cookies
})

// This seems to do the trick just fine for WSJ
reqHeaders.push({
"name": "X-Forwarded-For",
"value": "66.249.66.1"
})

return {requestHeaders: reqHeaders};
}

Expand Down
4 changes: 1 addition & 3 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Anti-Paywall",
"version": "0.2",
"version": "0.3",
"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/*",
Expand All @@ -19,7 +19,6 @@
"*://*.forbes.com/*",
"*://*.ft.com/*",
"*://*.geelongadvertiser.com.au/*",
"*://*.glassdoor.com/*",
"*://*.haaretz.co.il/*",
"*://*.haaretz.com/*",
"*://*.hbr.org/*",
Expand All @@ -35,7 +34,6 @@
"*://*.nationalpost.com/*",
"*://*.newsweek.com/*",
"*://*.newyorker.com/*",
"*://*.nnsl.com/*",
"*://*.nrc.nl/*",
"*://*.nytimes.com/*",
"*://*.ocregister.com/*",
Expand Down

0 comments on commit 5f689df

Please sign in to comment.