Fast Scraper avatar
Fast Scraper
Try Actor

$5.00/month

View all Actors
Fast Scraper

Fast Scraper

danielherman/fast-scraper
Try Actor

$5.00/month

Fast Scraper is a blazingly fast web scraper powered by Rust on the backend. It allows you to scrape static HTML pages extremely quickly while using only <128 MB of memory. With this scraper, you can maximize the efficiency of your credits on Apify.

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

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    "requests": [
11        {
12            "url": "https://www.scrapethissite.com/pages/simple/"
13        },
14        {
15            "id": "forms",
16            "url": "https://www.scrapethissite.com/pages/simple/",
17            "extract": [
18                {
19                    "field_name": "extracted_html",
20                    "selector": "#countries > div > div:nth-child(4) > div:nth-child(1)",
21                    "extract_type": "HTML"
22                }
23            ]
24        },
25        {
26            "id": "hockey",
27            "url": "https://www.scrapethissite.com/pages/forms/",
28            "extract": [
29                {
30                    "field_name": "year1",
31                    "selector": "#hockey > div > table > tbody > tr:nth-child(2) > td.year",
32                    "extract_type": "Text"
33                },
34                {
35                    "field_name": "year2",
36                    "selector": "#hockey > div > table > tbody > tr:nth-child(3) > td.year",
37                    "extract_type": "Text"
38                },
39                {
40                    "field_name": "class_name",
41                    "selector": "#hockey > div > table > tbody > tr:nth-child(2) > td.year",
42                    "extract_type": {
43                        "Attribute": "class"
44                    }
45                }
46            ]
47        }
48    ],
49    "proxy_settings": {
50        "useApifyProxy": true
51    }
52};
53
54(async () => {
55    // Run the Actor and wait for it to finish
56    const run = await client.actor("danielherman/fast-scraper").call(input);
57
58    // Fetch and print Actor results from the run's dataset (if any)
59    console.log('Results from dataset');
60    console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
61    const { items } = await client.dataset(run.defaultDatasetId).listItems();
62    items.forEach((item) => {
63        console.dir(item);
64    });
65})();
66
67// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs
Developer
Maintained by Community
Actor metrics
  • 1 monthly user
  • 0 stars
  • 93.2% runs succeeded
  • Created in Jun 2024
  • Modified 27 days ago
Categories