# Local Event Scraper (`herodcraperdz/local-event-scraper`) Actor

scrapes and aggregates local event data from various online sources, including community calendars, local news sites, venue websites, and specialized event platforms. The Actor normalizes the extracted data into a consistent format, making it easy to search, filter, and analyze.

- **URL**: https://apify.com/herodcraperdz/local-event-scraper.md
- **Developed by:** [choayb ouaret](https://apify.com/herodcraperdz) (community)
- **Categories:** AI
- **Security:** Full permissions
- **Stats:** 158 total users, 1 monthly users, 93.8% runs succeeded, 7 bookmarks
- **User rating**: 1.34 out of 5 stars

## Pricing

$0.50 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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

## 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 Actor

This Apify actor generates a list of fictional, but realistic, local events using the Google Gemini API. It's designed to simulate a web scraper, providing structured data based on user-defined criteria.

### Input

The actor takes the following input parameters, which can be configured in the Apify Console UI or via the API.

- **Location**: The city and state/country for the events (e.g., `Austin, TX`).
- **Keywords**: Comma-separated keywords to guide the event generation (e.g., `music, festival`).
- **Start Date**: The start of the date range for events (YYYY-MM-DD).
- **End Date**: The end of the date range for events (YYYY-MM-DD).
- **Sources**: Simulated sources to scrape from (e.g., `eventbrite.com`).
- **Maximum Events**: The number of events to generate.

See `INPUT_SCHEMA.json` for detailed definitions and defaults.

### Output

The actor saves the generated events into the default dataset. Each item in the dataset is a JSON object representing an event, with fields like `eventName`, `eventDate`, `venueName`, `eventDescription`, etc.

### Setup and Running on Apify

1. **Create an Actor**: Create a new actor on the Apify platform.
2. **Push Code**: Push the contents of this directory (`apify/`) to the actor's source code. You can do this using the Apify CLI or by connecting a GitHub repository.
3. **Set Environment Variable**: In the actor's settings, go to the "Environment variables" section. Add a new variable with the key `API_KEY`. Set its value to your Google Gemini API key and mark it as a "Secret".
4. **Build**: Build the actor on the Apify platform.
5. **Run**: Start an actor run, providing your desired input configuration. The results will appear in the run's dataset.

# Actor input Schema

## `location` (type: `string`):

The city and state/country for the events (e.g., 'Austin, TX').

## `keywords` (type: `string`):

Comma-separated keywords to focus the event generation (e.g., 'music, festival').

## `startDate` (type: `string`):

The start date for the event search range (YYYY-MM-DD). Leave blank for today.

## `endDate` (type: `string`):

The end date for the event search range (YYYY-MM-DD). Leave blank for 30 days from start.

## `sources` (type: `string`):

Comma-separated list of websites to simulate scraping from (e.g., 'eventbrite.com, meetup.com').

## `maxEvents` (type: `integer`):

The number of event entries to generate.

## Actor input object example

```json
{
  "location": "Austin, TX",
  "keywords": "music, festival",
  "startDate": "",
  "endDate": "",
  "sources": "",
  "maxEvents": 20
}
```

# 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 = {
    "startDate": "",
    "endDate": "",
    "sources": ""
};

// Run the Actor and wait for it to finish
const run = await client.actor("herodcraperdz/local-event-scraper").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 = {
    "startDate": "",
    "endDate": "",
    "sources": "",
}

# Run the Actor and wait for it to finish
run = client.actor("herodcraperdz/local-event-scraper").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 '{
  "startDate": "",
  "endDate": "",
  "sources": ""
}' |
apify call herodcraperdz/local-event-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,herodcraperdz/local-event-scraper"
        }
    }
}
```

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/HsbbnehhBEHVfndjl/builds/5Fc5MLhFWtWYqOE6y/openapi.json
