Javascript API client

Javascript client allows you to easily integrate the ScrapingAnt API in your JS project.


@scrapingant/scrapingant-client is the official library to access ScrapingAnt API from your JavaScript applications. It runs both in Node.js and browser and provides useful features like automatic retries and parameters encoding to improve the ScrapingAnt usage experience.

It can be installed via NPM:

npm i @scrapingant/scrapingant-client

Or via Yarn:

yarn add @scrapingant/scrapingant-client

Or check out the Github project page.

Start consuming API#

In order to get API key you'll need to register at ScrapingAnt Service

Usage of ScrapingAnt API client is quite straight forward, as it supports all the input and output describe at Request and response format page. Below you can find an example of it's usage:

const ScrapingAntClient = require('@scrapingant/scrapingant-client');
const client = new ScrapingAntClient({ apiKey: '<YOUR-SCRAPINGANT-API-KEY>' });
// Scrape the site.
.then(res => console.log(res))
.catch(err => console.error(err.message));

Response will be returned in the described format as too:

"content":"<!DOCTYPE html><html><head>\n <title>Example Domain</title>\n\n <meta charset=\"utf-8\">\n <meta http-equiv=\"Content-type\" content=\"text/html; charset=utf-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n <style type=\"text/css\">\n body {\n background-color: #f0f0f2;\n margin: 0;\n padding: 0;\n font-family: -apple-system, system-ui, BlinkMacSystemFont, \"Segoe UI\", \"Open Sans\", \"Helvetica Neue\", Helvetica, Arial, sans-serif;\n \n }\n div {\n width: 600px;\n margin: 5em auto;\n padding: 2em;\n background-color: #fdfdff;\n border-radius: 0.5em;\n box-shadow: 2px 3px 7px 2px rgba(0,0,0,0.02);\n }\n a:link, a:visited {\n color: #38488f;\n text-decoration: none;\n }\n @media (max-width: 700px) {\n div {\n margin: 0 auto;\n width: auto;\n }\n }\n </style> \n</head>\n\n<body>\n<div>\n <h1>Example Domain</h1>\n <p>This domain is for use in illustrative examples in documents. You may use this\n domain in literature without prior coordination or asking for permission.</p>\n <p><a href=\"\">More information...</a></p>\n</div>\n\n\n</body></html>",

Javascript library automatically encodes JS snippet for you, so, please, avoid encoding on your side.

API reference#

All the additional info can be found at the ScrapingAnt Javascript client page.

Issues and tracking#

In order to help us improving our service, please, don't hesitate to create an issue or feature request at Github