API / JSON scraper avatar
API / JSON scraper
Try for free

1 day trial then $5.00/month - No credit card required now

View all Actors
API / JSON scraper

API / JSON scraper

pocesar/json-downloader
Try for free

1 day trial then $5.00/month - No credit card required now

Scrape 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/json-downloader").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
  • 17 monthly users
  • 99.4% runs succeeded
  • 56.4 days response time
  • Created in May 2022
  • Modified 4 months ago