# Airbnb Full-Year Price Tracker (`moving_beacon-owner1/my-actor-9`) Actor

This script scrapes detailed information about Airbnb listings, including SEO data, room details, and pricing breakdowns for specified check-in and check-out dates. The data is collected from multiple Airbnb URLs and saved in a CSV file for analysis.

- **URL**: https://apify.com/moving\_beacon-owner1/my-actor-9.md
- **Developed by:** [Jamshaid Arif](https://apify.com/moving_beacon-owner1) (community)
- **Categories:** Automation, Developer tools, Real estate
- **Stats:** 95 total users, 2 monthly users, 100.0% runs succeeded, 5 bookmarks
- **User rating**: 4.00 out of 5 stars

## Pricing

from $4.99 / 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?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — 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

## Airbnb Data Scraper for Apify

This project is an **Apify actor** designed to scrape detailed data from Airbnb listings, including SEO metadata, pricing details, and other key information. The actor supports dynamic date generation for flexible booking queries and stores the extracted data in an Apify dataset.

***

### Features

- **Dynamic Date Generation**: Automatically generates check-in and check-out dates based on user input.
- **Comprehensive Data Extraction**:
  - **SEO Metadata**: Title, meta description, canonical URL, and more.
  - **Pricing Details**: Breakdown of prices, including cleaning fee, service fee, and taxes.
  - **Property Information**: Room type, location, capacity, rating, and reviews.
- **Error Handling**: Gracefully handles API errors and continues processing other listings.
- **Data Storage**:
  - Outputs data to the Apify dataset.
  - Optionally saves data to a local CSV file for offline use.

***

### Input Parameters

The actor accepts the following input parameters:

| Parameter            | Description                                     | Example Value                             |
|----------------------|-------------------------------------------------|-------------------------------------------|
| `startUrls`          | List of Airbnb listing URLs to scrape.          | `[{"url": "https://www.airbnb.com/rooms/12345"}]` |
| `checkInDate`        | Starting date for check-in.                     | `"2024-11-21"`                            |
| `Stay_Days`          | Duration of each stay in days.                  | `1`                                       |
| `numberOfDays`       | Total number of days to iterate.                | `10`                                      |
| `adults`             | Number of adults for the booking.               | `2`                                       |
| `children`           | Number of children for the booking.             | `0`                                       |
| `pets`               | Indicates if pets are included.                 | `0`                                       |

***

### Output Data

The scraper outputs a dataset with detailed information for each listing and date range:

| Field Name              | Description                                                |
|-------------------------|------------------------------------------------------------|
| `Check-In Date`         | Generated check-in date.                                   |
| `Check-Out Date`        | Generated check-out date.                                  |
| `Booking Available`     | Indicates if instant booking is available.                 |
| `Title`                 | SEO title of the listing.                                  |
| `Meta Description`      | SEO meta description of the listing.                       |
| `Canonical URL`         | Canonical URL of the listing page.                         |
| `Room Info`             | General description of the room.                           |
| `Property Type`         | Type of property (e.g., apartment, house).                 |
| `Room Rating`           | Star rating of the listing.                                |
| `Total Reviews`         | Total number of reviews.                                   |
| `Location`              | Location of the listing.                                   |
| `Capacity`              | Maximum number of guests the property can accommodate.     |
| `Image URL`             | URL of the primary listing image.                          |
| `Price Breakdown Title` | Title of the price breakdown section.                      |
| `Strike Through Price`  | Original price before discounts.                           |
| `Primary Price`         | Current price after discounts.                             |
| `Cleaning Fee`          | Cleaning fee for the booking.                              |
| `Service Fee`           | Service fee for the booking.                               |
| `Taxes`                 | Tax amount for the booking.                                |
| `Total Price`           | Total price for the stay, including fees and taxes.        |

***

### How It Works

1. **Dynamic Date Generator**:
   - Generates a sequence of check-in and check-out dates based on the input `checkInDate`, `Stay_Days`, and `numberOfDays`.

2. **Data Extraction**:
   - Makes a GraphQL API call to Airbnb using dynamically generated queries.
   - Extracts specific SEO and pricing details using a recursive function to traverse JSON paths.

3. **Data Storage**:
   - Stores data in the Apify dataset for further processing or integration.
   - Optionally saves the data to a local CSV file.

***

### Example Input

```json
{
  "startUrls": [
    { "url": "https://www.airbnb.com/rooms/12345" },
    { "url": "https://www.airbnb.com/rooms/67890" }
  ],
  "checkInDate": "2024-11-21",
  "Stay_Days": 1,
  "numberOfDays": 5,
  "adults": "2",
  "children": "0",
  "pets": "0"
}
```

***

### Example Output

| Check-In Date | Check-Out Date | Title                   | Total Price | Room Rating | Total Reviews |
|---------------|----------------|-------------------------|-------------|-------------|---------------|
| 2024-11-21    | 2024-11-22     | Cozy Apartment in City  | $120        | 4.8         | 120           |
| 2024-11-22    | 2024-11-23     | Spacious Condo by Beach | $200        | 4.9         | 85            |

***

### Logging and Debugging

The script uses Python's `logging` module to log:

- Progress of the scraping process.
- Errors encountered during API calls or data processing.

Logs are displayed in the console and can be used to debug issues.

***

### License

This project is licensed under the MIT License.

# Actor input Schema

## `startUrls` (type: `array`):

Enter apartments links

## `checkInDate` (type: `string`):

Default check-in date (format: YYYY-MM-DD) eg 2025-02-24

## `Stay_Days` (type: `integer`):

Number of days between check-in and check-out dates

## `numberOfDays` (type: `string`):

Number of days to calculate check-in and check-out dates

## `adults` (type: `integer`):

Number of adults

## `children` (type: `integer`):

Number of children

## `pets` (type: `integer`):

Number of pets

## `currency` (type: `string`):

Select the currency

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://www.airbnb.co.uk/rooms/7431972"
    }
  ],
  "Stay_Days": 1,
  "numberOfDays": "60",
  "adults": 2,
  "children": 0,
  "pets": 0,
  "currency": "USD"
}
```

# 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 = {
    "startUrls": [
        {
            "url": "https://www.airbnb.co.uk/rooms/7431972"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("moving_beacon-owner1/my-actor-9").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 = { "startUrls": [{ "url": "https://www.airbnb.co.uk/rooms/7431972" }] }

# Run the Actor and wait for it to finish
run = client.actor("moving_beacon-owner1/my-actor-9").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 '{
  "startUrls": [
    {
      "url": "https://www.airbnb.co.uk/rooms/7431972"
    }
  ]
}' |
apify call moving_beacon-owner1/my-actor-9 --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,moving_beacon-owner1/my-actor-9"
        }
    }
}

```

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/g3fjVGo0C0ek52Q4h/builds/9dSZmw3SZCD3SsdwY/openapi.json
