Web Scraping using ZenScrape

The Zenscrape is a SaaS platform that provides an easy-to-use API to scrape websites and collect useful data. The Zenscrape platform provides the developer an easy to use, fast and proxy-enabled web scraping platform.

Zenscrape provides the following features:

  • Easy to use API.
  • Lighting fast API response.
  • JavaScript rendering support.
  • Proxy crawler servers.
  • Single page application crawling support.
  • Free plan and affordable premium plans.

How to use Zenscrape API

To use Zenscrape crawling API, you need to create an account on Zenscrape and obtain an api token key.

You can simply navigate to the sign-up page and create a new free account.

Once you have created your account, Zenscrape will send an email to your account to verify your address. Once your email address is verified, Zenscrape will generate an API key for you. Make sure that you don’t share it with unauthorized users.

Let’s call a simple API to observe how it works. Here is a CURL command to crawl and extract HTML from the homepage of our website.

curl "https://app.zenscrape.com/api/v1/get?apikey=YOUR_API_KEY&url=https%3A%2F%2Fcodeforgeek.com"

Once you hit the request, Zenscrape will scrape the website and return the response. Simple as that.

Integrating with Node.js

Here is a sample code to Integrate Zenscrape API with Node.js.

Create a new Node project.

npm init --y

Install axios node module to perform HTTP calls.

npm install --save axios

Replace the apikey variable with your own API key.

const axios = require('axios');
const params = {
  url: 'https://codeforgeek.com',
  apikey: 'YOUR_API_KEY'
}

axios.get('https://app.zenscrape.com/api/v1/get', {params})
  .then(response => {
    const apiResponse = response.data;
    console.log(apiResponse);
  }).catch(error => {
    console.log(error);
  });

Save the file and name it app.js. Run the code using the following command.

node app.js

You should see the following output in the terminal.

Awesome. We made the integration in a minute. This is how easy it is to use Zenscrape crawler APIs.

This is just a tip of the iceberg, Zenscrape provides lots of useful information related to their API’s in the documentation page.

Pankaj Kumar
Pankaj Kumar
Articles: 209