# Incremental Web Crawler (`flamboyant_leaf/incrementalcrawler-v2`) Actor

The Incremental Crawler efficiently fetches URLs of recently added or updated web pages on a target site, optimizing resources by focusing only on new content. Ideal for keeping up with the latest updates, it integrates seamlessly into workflows for content monitoring and analysis.

- **URL**: https://apify.com/flamboyant_leaf/incrementalcrawler-v2.md
- **Developed by:** [AIRabbit](https://apify.com/flamboyant_leaf) (community)
- **Categories:** Automation, Integrations
- **Stats:** 42 total users, 1 monthly users, 100.0% runs succeeded, 4 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-usage

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Apify Incremental Link Crawler for Recent Web Pages

Are you frustrated by the time, money, and resources wasted on repeatedly crawling **entire websites** just to track a **few** new or **updated pages**? The majority of websites undergo minimal changes between crawls, yet you are required to process the same outdated content repeatedly, which results in the inefficient use of resources and a more complex workflow.

The **Incremental Crawler** eliminates the need for this process. This tool identifies the most recent pages, automatically detecting new or updated content and integrating it directly into your workflow. Instead of re-evaluating the entire content set, your process focuses on a small fraction of the content, significantly reducing costs and processing time.
You can now run your crawls more frequently and obtain up-to-date data with minimal delay—typically within a day. Keep your information pipeline fresh and efficient without the hassle of redundant crawls.

### ![1724438400890](https://github.com/deepmtch/images/raw/58538ac8e45991f43749ff8bb9d4c33685d2ecf5/Craigslist-Example.png)Why Use Incremental Crawler?

- **Efficient**: The actor scans **any website** for recent updates, saving users time and resources.
- **Cost-saving**: By handling less data, Apify reduces your computing and storage costs, both online and offline. This eliminates the need to process large amounts of unchanged data, which in turn reduces your overall costs.
- **Up-to-date**: Keeps you informed about the latest changes on the website.
- **Flexible**: Its flexibility allows it to integrate seamlessly into other tasks, such as monitoring, indexing, or analyzing content. It can be integrated with minimal disruption to existing workflows.

### How It Works

1. **Enter the Website URL and Time Frame**: Provide the URL of the website and specify how many days back you want to check for updates.
2. **Find New or Updated Pages**: The crawler will identify pages that have been added or updated within that time frame.
3. **Receive a List of URLs**: You'll get a list of URLs for the newly added or updated pages.

### What You Need to Provide

- **URL**: The website you want to monitor.
- **Days Ago**: How far back you want to look for changes (default is 1 day).

**Optional:**

- **Max Results**: The maximum number of URLs you want to get (default is 50).
- **Language**: The language of the results (default is 'en').
- **Country**: The country for the search (default is 'us').
- **Search Domain**: The domain to use for the search (default is 'com').
- **Next Run ID**: ID for the next task (optional).
- **Next Run Attribute**: Attribute to update in the next run (default is 'startUrls', optional).

### How to Choose the Right URL?

To make the most of this crawler, ask yourself:

"What is the main URL for the section or category I want to monitor?"

The URL should lead directly to a general page for that section, not a search results page.

### Example: Craigslist

✅ DO Use this: <https://albany.craigslist.org/pet>

This URL points to the main "For Sale" section for the San Francisco Bay Area on Craigslist.

**Output:**
https://albany.craigslist.org/pet/d/amsterdam-bulldog-female/7777952367.html
https://albany.craigslist.org/pet/d/johnstown-flemish-bunny/7777825167.html
https://albany.craigslist.org/pet/d/schenectady-love-birds/7777992864.html
https://albany.craigslist.org/pet/d/mechanicville-rehoming-my-babies-luna/7777864880.html
https://albany.craigslist.org/pet/d/mechanicville-bichir/7777915783.html
https://albany.craigslist.org/pet/d/schenectady-free-kittens/7778024580.html
https://albany.craigslist.org/pet/d/herkimer-siberian-husky/7777994168.html
https://albany.craigslist.org/pet/d/schenectady-small-animal-enclosure/7777940237.html
https://albany.craigslist.org/pet/d/schenectady-small-zilla-enclosure/7777912041.html
https://albany.craigslist.org/pet/d/mechanicville-black-arowana/7777916422.html

❌ DON'T use search or listing URLs like:

- https://sfbay.craigslist.org/search/sss?query=pet (a search results URL)

### Please Note

1. New pages are usually ready for crawling after about a day, sometimes sooner, but this isn't guaranteed.
2. The crawler can only reach pages that search engines like Google can see.
3. This crawler works well on various sites, but its performance depends on how easily it can be found on search engines. Please test it on your own website before udpating your workflow.

#### Integrating with other Actors

To use the URLs fetched by this crawler in another task:

1. **Set Up the Next Task**: Create a task for the next step in your workflow.
2. **Configure the Crawler**: In the Incremental Crawler's settings, provide the `nextRunId` (the ID of the task you created) and `nextRunAttribute` (usually 'startUrls').
3. **Automate the Process**: The crawler will automatically start the specified task with the fetched URLs.

![Create a new task](https://airabbit.blog/content/images/2024/08/1-5.jpg)
![Start the incremental crawler with the taskID](https://airabbit.blog/content/images/2024/08/image-55.png)

**How can we help?**

We're here for you! If you have any questions or need help with anything, please don't hesitate to reach out.

We're always happy to help.

# Actor input Schema

## `url` (type: `string`):

The URL to check for new pages

## `daysAgo` (type: `integer`):

Number of days to look back for new URLs

## `language` (type: `string`):

Language for search results

## `country` (type: `string`):

Country for search results

## `searchDomain` (type: `string`):

Domain to use for search

## `nextRunId` (type: `string`):

ID of the next task to run

## `nextRunAttribute` (type: `string`):

Attribute to replace in the next run (default: startUrls)

## `maxResults` (type: `integer`):

Maximum number of results to fetch

## Actor input object example

```json
{
  "url": "www.example.com",
  "daysAgo": 1,
  "language": "en",
  "country": "us",
  "searchDomain": "google.com",
  "nextRunId": "-1",
  "nextRunAttribute": "-1",
  "maxResults": 1
}
```

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "url": "www.example.com",
    "daysAgo": 1,
    "language": "en",
    "country": "us",
    "searchDomain": "google.com",
    "nextRunId": "-1",
    "nextRunAttribute": "-1",
    "maxResults": 1
};

// Run the Actor and wait for it to finish
const run = await client.actor("flamboyant_leaf/incrementalcrawler-v2").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "url": "www.example.com",
    "daysAgo": 1,
    "language": "en",
    "country": "us",
    "searchDomain": "google.com",
    "nextRunId": "-1",
    "nextRunAttribute": "-1",
    "maxResults": 1,
}

# Run the Actor and wait for it to finish
run = client.actor("flamboyant_leaf/incrementalcrawler-v2").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "url": "www.example.com",
  "daysAgo": 1,
  "language": "en",
  "country": "us",
  "searchDomain": "google.com",
  "nextRunId": "-1",
  "nextRunAttribute": "-1",
  "maxResults": 1
}' |
apify call flamboyant_leaf/incrementalcrawler-v2 --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,flamboyant_leaf/incrementalcrawler-v2"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/XMB6HvzdX9AOYbnYG/builds/UCFqAUBwow016Ro6B/openapi.json
