Node.js package to bypass WAF anti-bot JavaScript challenges
npm install humanoid-js2A Node.js package to bypass WAF anti-bot JS challenges.
Brotli content-encoding. Not supported by Node.js' request by default!
npm install --save humanoid-js
`Usage
Basic usage with promises:
`javascript
const Humanoid = require("humanoid-js");let humanoid = new Humanoid();
humanoid.get("https://www.cloudflare-protected.com")
.then(res => {
console.log(res.body) // ...
})
.catch(err => {
console.error(err)
})
`
Humanoid uses auto-bypass by default. You can override it on instance creation:
`javascript
let humanoid = new Humanoid(autoBypass=false)humanoid.get("https://canyoupwn.me")
.then(res => {
console.log(res.statusCode) // 503
console.log(res.isSessionChallenged) // true
humanoid.bypassJSChallenge(res)
.then(challengeResponse => {
// Note that challengeResponse.isChallengeSolved won't be set to true when doing manual bypassing.
console.log(challengeResponse.body) // ...
})
}
)
.catch(err => {
console.error(err)
})
`
async/await is also supported, and is the preferred way to go:
`javascript
(async function() {
let humanoid = new Humanoid();
let response = await humanoid.sendRequest("www.cloudflare-protected.com")
console.log(response.body) // ...
}())
`
$3
`javascript 1.8
rotateUA() // Replace the currently set user agent with a different one
clearCookies() // "Set a new, empty cookie jar for the humanoid instance"
get(url, queryString=undefined, headers=undefined) // Send a GET request to url.
// if passed, queryString and headers should be objects
post(url, postBody=undefined, headers=undefined, dataType=undefined) // Send a POST request to url.
// dataType should be either "form" or "json" - based on the content type of the POST request.
sendRequest(url, method=undefined, data=undefined, headers=undefined, dataType=undefined)
// Send a request of method method to url
bypassJSChallenge(response) // Bypass the anti-bot JS challenge found in response.body
``