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 more

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    console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
35    const { items } = await client.dataset(run.defaultDatasetId).listItems();
36    items.forEach((item) => {
37        console.dir(item);
38    });
39})();
40
41// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs
Developer
Maintained by Community
Actor metrics
  • 2 monthly users
  • 93.5% runs succeeded
  • 0.0 days response time
  • Created in Nov 2023
  • Modified 5 months ago