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

Commit

Permalink
Merge 0878a74 into ef9d5ef
Browse files Browse the repository at this point in the history
  • Loading branch information
codemanki committed Apr 7, 2019
2 parents ef9d5ef + 0878a74 commit 2d4236e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## Change Log

### v3.7.0 (07/04/2019)
- [#182](https://github.com/codemanki/cloudscraper/pull/182) Usage examples have been added.
- [#169](https://github.com/codemanki/cloudscraper/pull/169) Cloudscraper now automatically parses out timeout for a CF challenge. `cloudflareTimeout` still can be used, but will be deprecated soon

### v3.6.0 (03/04/2019)
- [#180](https://github.com/codemanki/cloudscraper/pull/180) Update code to parse latest CF challenge

Expand Down
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ cloudscraper(options, function(err, response, body) {
});
```

## Examples
Check out the [examples folder](https://github.com/codemanki/cloudscraper/tree/master/examples) for various use cases.

## Advanced usage
Cloudscraper wraps request and request-promise, so using cloudscraper is pretty much like using those two libraries.
- Cloudscraper exposes [the same request methods as request](https://github.com/request/request#requestmethod):
Expand Down Expand Up @@ -155,8 +158,9 @@ var options = {
'Cache-Control': 'private',
'Accept': 'application/xml,application/xhtml+xml,text/html;q=0.9, text/plain;q=0.8,image/png,*/*;q=0.5'
},
// Cloudflare requires a delay of 4 seconds, so wait for at least 5.
cloudflareTimeout: 5000,
// Normaly Cloudscraper will take care of parsing out timeout for a challenge and handles it for you.
// If you want, you can reduce Cloudflare's timeout to cloudflareMaxTimeout if it is excessive
cloudflareMaxTimeout: 30000,
// followAllRedirects - follow non-GET HTTP 3xx responses as redirects
followAllRedirects: true,
// Support only this max challenges in row. If CF returns more, throw an error
Expand Down
2 changes: 2 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,8 @@ function solveChallenge (options, response, body) {
cause = 'Failed to parse challenge timeout';
return callback(new errors.ParserError(cause, options, response));
}
} else {
console.warn('Warning: `cloudflareTimeout` is deprecated. Cloudscraper automatically handles timeout for you. Use `cloudflareMaxTimeout` to reduce timeout if you need to');
}

response.challenge = match[1]
Expand Down

0 comments on commit 2d4236e

Please sign in to comment.