Skip to content
This repository has been archived by the owner on Apr 25, 2021. It is now read-only.

Latest commit

 

History

History
39 lines (35 loc) · 1021 Bytes

migration-guide.md

File metadata and controls

39 lines (35 loc) · 1021 Bytes

Migration from v2 to v3

  • Replace cloudscraper.request(options) with cloudscraper(options)
  • cloudscraper.get() and cloudscraper.post() method signatures are aligned with corresponding methods from request:
var options = {
  uri: 'https://website.com/',
  headers: {/*...*/}
};

cloudscraper.get(options, function(error, response, body) {
  console.log(body);
});

or for POST

var options = {
  uri: 'https://website.com/',
  headers: {/*...*/},
  formData: { field1: 'value', field2: 2 }
};

cloudscraper.post(options, function(error, response, body) {
  console.log(body);
});
  • If you are using custom promise support workarounds please remove them as cloudscraper now uses request-promise:
var cloudscraper = require('cloudscraper');
var options = {
  uri: 'https://website.com/',
  method: 'GET'
};

cloudscraper(options).then(function(body) {
  console.log(body);
});