Getting Started with Our Node.js Client
Setup
In your project, install the get-scraping client:
npm install get-scraping
# or
yarn add get-scraping
Usage
import { GetScrapingClient, GetScrapingParams } from 'cheerio';
import * as cheerio from 'cheerio';
...
const client = new GetScrapingClient({{YOUR_API_KEY}});
...
const scrapeOptions: GetScrapingParams = {
url: 'example.com',
method: 'GET',
}
const result = client.scrape(scrapeOptions)
...
// Use the result headers
const headers = result.headers;
...
// Verify you got the status code you're looking for
if (result.status !== 200) {
// Handle error
}
...
// Load the html and pull the data you need
const $ = cheerio.load(await result.text());
const pageTitle = $('title').text()
See our node examples for more detailed usage.