Customize Taking a Website Screenshots via ScraperAPI in NodeJS
Learn how to take a screenshot of a page when scraping with ScraperAPI in NodeJS. Capture page images using screenshot=true. Ideal for monitoring and documentation.
Our Java Script solution now gives you the ability to take a screenshot of the target page through the use of the parameter screenshot=true
. This parameter automatically enables JS rendering to get the full page content, before taking a screenshot.
After we serve the response, you can find the screenshot URL in the sa-screenshot
response header. The screenshot format is PNG
:

API REQUEST
import request from 'request-promise';
request({
uri: 'http://api.scraperapi.com/',
qs: {
api_key: 'API_KEY',
screenshot: true,
url: 'https://example.com/'
},
resolveWithFullResponse: true
})
.then(response => {
console.log(response);
})
.catch(error => {
console.log(error);
console.log('Response Headers:', response.headers);
});
ASYNC REQUEST
import axios from 'axios';
(async () => {
try {
const { data } = await axios({
method: 'POST',
url: 'https://async.scraperapi.com/batchjobs',
data: {
apiKey: 'API_KEY',
url: 'https://example.com/',
apiParams: {
screenshot: 'true'
}
}
});
console.log(data);
} catch (error) {
console.error(error);
}
})();
PROXY MODE - COMING SOON!
PreviousUse Render Instruction Set to Scrape Dynamic Pages in NodeJSNextCustomize Scrape Session-Based Proxies via ScraperAPI in NodeJS
Last updated
Was this helpful?