SDK Method | NodeJS
Learn to implement ScraperAPI's NodeJS SDK for efficient web scraping. Includes setup for Requests and Scrapy, with advanced features like JS rendering.
To make it easier to get up and running you can also use our SDK. First, you will need to install the SDK:
npm install scraperapi-sdk --save
Then integrate it into your code:
// remember to install the library: npm install scraperapi-sdk --save
const scraperapiClient = require('scraperapi-sdk')('APIKEY')
scraperapiClient.get('http://httpbin.org/ip')
.then(response => {
console.log(response)
})
.catch(error => {
console.log(error)
})
To enable extra functionality while using our SDK, simply add an additional parameter to the GET request:
// remember to install the library: npm install scraperapi-sdk --save
const scraperapiClient = require('scraperapi-sdk')('APIKEY')
scraperapiClient.get('http://httpbin.org/ip', {render: true})
.then(response => {
console.log(response)
})
.catch(error => {
console.log(error)
})
To use two or more parameters, simply add them to the GET request:
// remember to install the library: npm install scraperapi-sdk --save
const scraperapiClient = require('scraperapi-sdk')('APIKEY')
const params = {
render: true,
country_code: 'us'
}
scraperapiClient.get('http://httpbin.org/ip', params)
.then(response => {
console.log(response)
})
.catch(error => {
console.log(error)
})
Last updated
Was this helpful?