Pay-as-you-go API / JSON scraper avatar
Pay-as-you-go API / JSON scraper
Try for free

Pay $25.00 for 1,000 results

View all Actors
Pay-as-you-go API / JSON scraper

Pay-as-you-go API / JSON scraper

pocesar/pay-as-you-go-api-json-scraper
Try for free

Pay $25.00 for 1,000 results

Scrape as pay-as-you-go any API / JSON URLs directly to the dataset, and return them in CSV, XML, HTML, or Excel formats. Transform and filter the output. Enables you to follow pagination recursively from the payload without the need to visit the HTML page.

The code examples below show how to run the Actor and get its results. To run the code, you need to have an Apify account. Replace <YOUR_API_TOKEN> in the code with your API token, which you can find under Settings > Integrations in Apify Console. Learn mode

Node.js

Python

curl

1import { ApifyClient } from 'apify-client';
2
3// Initialize the ApifyClient with your Apify API token
4const client = new ApifyClient({
5    token: '<YOUR_API_TOKEN>',
6});
7
8// Prepare Actor input
9const input = {
10    "startUrls": [
11        {
12            "url": "https://blockchain.info/latestblock"
13        }
14    ],
15    "filterMap": async ({ request, response, addRequest, flattenObjectKeys, context, Apify, _, moment, data, input, customData }) => {
16      return { url: request.url, data };
17    },
18    "handleError": async ({ error, request, response, addRequest, _, moment, Apify, input, context }) => {
19      
20    },
21    "customData": {},
22    "proxyConfig": {
23        "useApifyProxy": true
24    },
25    "maxRequestRetries": 4
26};
27
28(async () => {
29    // Run the Actor and wait for it to finish
30    const run = await client.actor("pocesar/pay-as-you-go-api-json-scraper").call(input);
31
32    // Fetch and print Actor results from the run's dataset (if any)
33    console.log('Results from dataset');
34    const { items } = await client.dataset(run.defaultDatasetId).listItems();
35    items.forEach((item) => {
36        console.dir(item);
37    });
38})();
Developer
Community logoMaintained by Community
Actor metrics
  • 5 monthly users
  • 100.0% runs succeeded
  • Created in Nov 2023
  • Modified 3 months ago

You might also like these Actors