# ICS Calendar Feed Merger & Deduplicator (`bene123/ics-calendar-feed-merger-deduplicator`) Actor

Combine up to 50 public iCal/ICS feeds into one recurrence-aware, filtered, deduplicated JSON or CSV event dataset.

- **URL**: https://apify.com/bene123/ics-calendar-feed-merger-deduplicator.md
- **Developed by:** [Ben E](https://apify.com/bene123) (community)
- **Categories:** Automation, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 unique merged calendar events

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

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

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js/docs.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python/docs.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## ICS Calendar Feed Merger & Deduplicator

Combine several public iCal / ICS calendar feeds into one clean, recurrence-aware event dataset. The Actor expands recurring events inside a bounded date window, applies cancellation and keyword filters, removes cross-calendar duplicates, and preserves every contributing source calendar.

Use it for community-event pipelines, school or municipal calendar aggregation, venue and tourism feeds, public holiday calendars, content operations, or automation workflows that need normalized JSON/CSV instead of several subscribed calendars.

### What this Actor adds beyond an ICS parser

A parser turns one calendar file into event objects. This Actor handles the next operational layer:

- fetch up to 50 public calendar feeds
- expand RRULE occurrences within a date window
- apply EXDATE exclusions and RECURRENCE-ID overrides
- exclude cancelled events by default
- filter across title, description, location, and categories
- deduplicate the same occurrence across overlapping calendars
- merge source provenance and useful metadata
- sort the final dataset by the next event first
- export through Apify as JSON, CSV, Excel, XML, RSS, or API data

It follows [RFC 5545](https://www.rfc-editor.org/rfc/rfc5545) iCalendar semantics through the maintained `node-ical` parser.

### Quick start

The only required input is `calendarUrls`:

```json
{
  "calendarUrls": [
    "https://www.gov.uk/bank-holidays/england-and-wales.ics"
  ],
  "expandRecurring": true,
  "excludeCancelled": true,
  "deduplicateBy": "smart",
  "maxTotalEvents": 5000
}
````

Leave `dateFrom` and `dateTo` blank to process the next 90 days. An explicit window can be up to 366 days:

```json
{
  "calendarUrls": ["https://example.org/public-events.ics"],
  "dateFrom": "2026-07-01T00:00:00Z",
  "dateTo": "2026-12-31T23:59:59Z",
  "includeKeywords": ["workshop", "family"],
  "excludeKeywords": ["private"],
  "deduplicateBy": "smart"
}
```

### Output

Each dataset row is one unique event occurrence:

```json
{
  "title": "Community workshop",
  "start_at": "2026-08-12T22:00:00.000Z",
  "end_at": "2026-08-12T23:30:00.000Z",
  "start_date": null,
  "end_date": null,
  "timezone": "America/New_York",
  "all_day": false,
  "duration_minutes": 90,
  "location": "Main Library",
  "description": "Registration requested.",
  "event_url": "https://example.org/events/community-workshop",
  "organizer_name": "Programs Team",
  "status": "CONFIRMED",
  "categories": ["Workshop"],
  "uid": "workshop-2026@example.org",
  "is_recurring_instance": true,
  "source_calendar_name": "Community Events",
  "source_calendar_url": "https://example.org/public-events.ics",
  "duplicate_count": 2,
  "duplicate_source_calendars": [
    "https://example.org/public-events.ics",
    "https://example.net/area-events.ics"
  ],
  "dedupe_key": "uid:workshop 2026 example org|2026-08-12T22:00:00.000Z",
  "merged_at": "2026-07-11T22:30:00.000Z"
}
```

The `OUTPUT` key-value-store record summarizes successful and failed calendars, parsed and filtered events, duplicates removed, unique rows emitted, the date window, and truncation state.

### Deduplication choices

- **Smart** — UID plus occurrence time when a UID exists; otherwise normalized title, start time, and location.
- **UID + occurrence time** — explicitly prefer the event UID for overlapping feeds, with the title/time/location fallback when a UID is missing.
- **Title + time + location** — useful when different publishers issue different UIDs for the same public event.

The Actor keeps the longest description and fills missing location or event URL from duplicates. `duplicate_count` and `duplicate_source_calendars` make every merge inspectable.

### Recurring events

With `expandRecurring` enabled, the Actor emits individual occurrences only inside the selected date window. It applies EXDATE removals and RECURRENCE-ID overrides and respects time-zone information supplied by the feed. A 366-day maximum prevents an unbounded recurrence rule from producing unlimited output.

Disable recurrence expansion only when you want original VEVENT records whose base start falls inside the window; future instances of an older base event will not be synthesized in that mode.

### Pricing

- Apify's automatic Actor-start event: **$0.00005 per run**
- Unique merged event occurrence: **$0.001 each** ($1 per 1,000)

Failed calendars, filtered events, cancelled events, duplicates removed before output, and rows beyond the configured cap are not charged as unique event occurrences.

### Safety and privacy

- Only user-supplied public HTTP or HTTPS calendar URLs are fetched.
- Event web links, attachments, alarms, and linked pages are never fetched.
- Private, local, reserved, credential-bearing, non-standard-port, oversized, redirect-looping, and invalid inputs are rejected.
- DNS and every redirect are revalidated against public address space; the selected public address is pinned for the request.
- Responses are capped at 2 MB, redirects at three, and each description at 500 characters.
- Attendee email addresses and raw ICS files are not emitted.

Public calendar feeds can still contain names, locations, descriptions, organizer information, or accidentally exposed details. Use only feeds you are authorized to process, avoid private or sensitive calendars, and review output before republishing it. This Actor is a deterministic data-processing tool, not a privacy, legal, compliance, scheduling, or safety guarantee.

### Limits

| Limit | Value |
|---|---:|
| Calendar URLs per run | 50 |
| Calendar response size | 2 MB |
| Redirects per calendar | 3 |
| Date window | 366 days |
| Events per calendar | 5,000 |
| Unique output rows | 20,000 |
| Include keywords | 20 |
| Exclude keywords | 20 |

### API use

Run `bene123/ics-calendar-feed-merger-deduplicator` from the Apify Console, API, CLI, scheduler, webhook, Make, Zapier, or another Actor. The default dataset can be downloaded in the format your workflow already uses.

### Support

Open an issue on the Actor page with a public reproducible calendar URL, the date window, and the expected versus actual result. Do not post private calendar URLs, access tokens, customer data, or attendee details.

# Actor input Schema

## `calendarUrls` (type: `array`):

Public HTTP or HTTPS .ics / iCalendar feed URLs. Private/local addresses, credentials, and non-standard ports are rejected.

## `dateFrom` (type: `string`):

Optional ISO date or date-time. Blank starts at run time.

## `dateTo` (type: `string`):

Optional ISO date or date-time. Blank uses 90 days after Events from. Maximum window is 366 days.

## `expandRecurring` (type: `boolean`):

Emit individual occurrences inside the date window while applying EXDATE exclusions and RECURRENCE-ID overrides.

## `excludeCancelled` (type: `boolean`):

Skip events and recurrence overrides marked CANCELLED.

## `deduplicateBy` (type: `string`):

Smart uses UID plus occurrence time when available, then normalized title, time, and location. Other modes force a preferred key with a safe fallback.

## `includeKeywords` (type: `array`):

Optional case-insensitive terms. Keep an event when title, description, location, or category contains at least one term.

## `excludeKeywords` (type: `array`):

Optional case-insensitive terms. Matching events are removed after the include filter.

## `maxEventsPerCalendar` (type: `integer`):

Stop after this many date-window occurrences from each calendar.

## `maxTotalEvents` (type: `integer`):

Emit at most this many unique rows after filtering and deduplication.

## `fetchTimeoutSecs` (type: `integer`):

Seconds to wait for each public calendar request.

## Actor input object example

```json
{
  "calendarUrls": [
    "https://www.gov.uk/bank-holidays/england-and-wales.ics"
  ],
  "dateFrom": "",
  "dateTo": "",
  "expandRecurring": true,
  "excludeCancelled": true,
  "deduplicateBy": "smart",
  "includeKeywords": [],
  "excludeKeywords": [],
  "maxEventsPerCalendar": 1000,
  "maxTotalEvents": 5000,
  "fetchTimeoutSecs": 15
}
```

# Actor output Schema

## `results` (type: `string`):

Filtered, recurrence-aware, deduplicated iCalendar event rows.

## `summary` (type: `string`):

Calendar success, failure, filter, recurrence, deduplication, event, and truncation counts.

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("bene123/ics-calendar-feed-merger-deduplicator").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 = {}

# Run the Actor and wait for it to finish
run = client.actor("bene123/ics-calendar-feed-merger-deduplicator").call(run_input=run_input)

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

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

```

## CLI example

```bash
echo '{}' |
apify call bene123/ics-calendar-feed-merger-deduplicator --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=bene123/ics-calendar-feed-merger-deduplicator",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "ICS Calendar Feed Merger & Deduplicator",
        "description": "Combine up to 50 public iCal/ICS feeds into one recurrence-aware, filtered, deduplicated JSON or CSV event dataset.",
        "version": "0.1",
        "x-build-id": "de3tdgzTf8Yzsm7Fj"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/bene123~ics-calendar-feed-merger-deduplicator/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-bene123-ics-calendar-feed-merger-deduplicator",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/bene123~ics-calendar-feed-merger-deduplicator/runs": {
            "post": {
                "operationId": "runs-sync-bene123-ics-calendar-feed-merger-deduplicator",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/bene123~ics-calendar-feed-merger-deduplicator/run-sync": {
            "post": {
                "operationId": "run-sync-bene123-ics-calendar-feed-merger-deduplicator",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "calendarUrls"
                ],
                "properties": {
                    "calendarUrls": {
                        "title": "Public ICS calendar URLs",
                        "minItems": 1,
                        "maxItems": 50,
                        "type": "array",
                        "description": "Public HTTP or HTTPS .ics / iCalendar feed URLs. Private/local addresses, credentials, and non-standard ports are rejected.",
                        "items": {
                            "type": "string",
                            "maxLength": 2048
                        },
                        "default": [
                            "https://www.gov.uk/bank-holidays/england-and-wales.ics"
                        ]
                    },
                    "dateFrom": {
                        "title": "Events from",
                        "type": "string",
                        "description": "Optional ISO date or date-time. Blank starts at run time.",
                        "default": ""
                    },
                    "dateTo": {
                        "title": "Events through",
                        "type": "string",
                        "description": "Optional ISO date or date-time. Blank uses 90 days after Events from. Maximum window is 366 days.",
                        "default": ""
                    },
                    "expandRecurring": {
                        "title": "Expand recurring events",
                        "type": "boolean",
                        "description": "Emit individual occurrences inside the date window while applying EXDATE exclusions and RECURRENCE-ID overrides.",
                        "default": true
                    },
                    "excludeCancelled": {
                        "title": "Exclude cancelled events",
                        "type": "boolean",
                        "description": "Skip events and recurrence overrides marked CANCELLED.",
                        "default": true
                    },
                    "deduplicateBy": {
                        "title": "Deduplication method",
                        "enum": [
                            "smart",
                            "uid",
                            "title-time"
                        ],
                        "type": "string",
                        "description": "Smart uses UID plus occurrence time when available, then normalized title, time, and location. Other modes force a preferred key with a safe fallback.",
                        "default": "smart"
                    },
                    "includeKeywords": {
                        "title": "Include keywords",
                        "maxItems": 20,
                        "type": "array",
                        "description": "Optional case-insensitive terms. Keep an event when title, description, location, or category contains at least one term.",
                        "items": {
                            "type": "string",
                            "maxLength": 100
                        },
                        "default": []
                    },
                    "excludeKeywords": {
                        "title": "Exclude keywords",
                        "maxItems": 20,
                        "type": "array",
                        "description": "Optional case-insensitive terms. Matching events are removed after the include filter.",
                        "items": {
                            "type": "string",
                            "maxLength": 100
                        },
                        "default": []
                    },
                    "maxEventsPerCalendar": {
                        "title": "Maximum events per calendar",
                        "minimum": 1,
                        "maximum": 5000,
                        "type": "integer",
                        "description": "Stop after this many date-window occurrences from each calendar.",
                        "default": 1000
                    },
                    "maxTotalEvents": {
                        "title": "Maximum merged events",
                        "minimum": 1,
                        "maximum": 20000,
                        "type": "integer",
                        "description": "Emit at most this many unique rows after filtering and deduplication.",
                        "default": 5000
                    },
                    "fetchTimeoutSecs": {
                        "title": "Calendar fetch timeout",
                        "minimum": 5,
                        "maximum": 30,
                        "type": "integer",
                        "description": "Seconds to wait for each public calendar request.",
                        "default": 15
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
