# Google Flights Scraper (`mlika-gaith/google-flights-scraper`) Actor

Scrapes Google Flights results for a given route and date, returning flight options with price, times, duration, stops, and CO2 estimate.

- **URL**: https://apify.com/mlika-gaith/google-flights-scraper.md
- **Developed by:** [Ghaith Mlika](https://apify.com/mlika-gaith) (community)
- **Categories:** Travel, Agents
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 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/platform/actors/running/actors-in-store#pay-per-usage

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

## Google Flights Scraper

Search Google Flights for a route and date, and get structured flight options: airline, flight number, departure/arrival times, duration, stops, price, currency, and estimated CO₂.

### How to use

1. Open this Actor in [Apify Console](https://console.apify.com).
2. Fill in the input form (or paste JSON).
3. Keep **proxy groups** set to `RESIDENTIAL` (recommended for Google).
4. Click **Start**.
5. Open the **Output** / **Dataset** tab when the run finishes.

You can also run it via the Apify API, schedules, or from an AI agent that can call Actors.

### Input

| Field | Required | Description |
| --- | --- | --- |
| `from` | Yes | Origin airport IATA code (e.g. `TUN`) |
| `to` | Yes | Destination airport IATA code (e.g. `CDG`) |
| `date` | Yes | Departure date `YYYY-MM-DD` |
| `returnDate` | No | Return date for round-trips; leave empty for one-way |
| `currency` | No | Price currency (default `USD`) |
| `language` | No | UI language code (default `en`) |
| `seat` | No | `economy`, `premium_economy`, `business`, or `first` |
| `adults` / `children` / `infantsInSeat` / `infantsOnLap` | No | Passenger counts |
| `maxRetries` | No | Retries on CAPTCHA / network errors (default `3`) |
| `proxyGroups` | No | Apify Proxy groups (default `["RESIDENTIAL"]`) |

#### Example

```json
{
  "from": "TUN",
  "to": "CDG",
  "date": "2026-09-01",
  "currency": "USD",
  "adults": 1,
  "seat": "economy",
  "proxyGroups": ["RESIDENTIAL"]
}
```

### Output

Each run pushes one dataset item with the search summary and a `flights` array.

```json
{
  "from": "TUN",
  "to": "CDG",
  "date": "2026-09-01",
  "trip": "one-way",
  "currency": "USD",
  "total_results": 11,
  "flights": [
    {
      "airline": "Air France",
      "flight_number": "AF1185",
      "departure_time": "18:45",
      "arrival_time": "22:20",
      "duration": "2 hr 35 min",
      "stops": 0,
      "price": 559,
      "currency": "USD",
      "co2_kg": 134,
      "from": "TUN",
      "to": "CDG",
      "date": "2026-09-01"
    }
  ],
  "scraped_at": "2026-08-06T18:14:56Z"
}
```

In Console, use the **Overview** view for the search summary and the **Flights** view for one row per itinerary.

### Requirements

- An Apify account with access to **Residential** proxy (or another group that works for Google). Datacenter IPs are often blocked.
- Valid 3-letter IATA codes and a real calendar date.

### Tips

- Prefer **RESIDENTIAL** in `proxyGroups` for higher success rates.
- If a run fails with CAPTCHA / forbidden errors, retry later or confirm your proxy plan includes the selected group: [Proxy settings](https://console.apify.com/proxy).
- Google Flights data can change; empty or partial results usually mean a temporary block or a page-layout change on Google’s side.

### Support

Open an issue on the Actor’s GitHub repository or contact the author from the Actor page on Apify.

# Actor input Schema

## `from` (type: `string`):

3-letter origin airport code, e.g. TUN

## `to` (type: `string`):

3-letter destination airport code, e.g. CDG

## `date` (type: `string`):

Departure date, YYYY-MM-DD

## `returnDate` (type: `string`):

Return date, YYYY-MM-DD. Leave empty for a one-way search.

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

ISO 4217 currency code for prices.

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

BCP-47 language code for the Google Flights UI.

## `seat` (type: `string`):

Cabin class to search: economy, premium\_economy, business, or first.

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

Number of adult passengers (age 12+).

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

Number of child passengers (age 2–11).

## `infantsInSeat` (type: `integer`):

Number of infants occupying their own seat (under 2).

## `infantsOnLap` (type: `integer`):

Number of infants seated on an adult's lap (under 2).

## `maxRetries` (type: `integer`):

How many times to retry on CAPTCHA or transient network errors.

## `proxyGroups` (type: `array`):

Apify Proxy groups to use. RESIDENTIAL is strongly recommended for Google.

## Actor input object example

```json
{
  "from": "TUN",
  "to": "CDG",
  "currency": "USD",
  "language": "en",
  "seat": "economy",
  "adults": 1,
  "children": 0,
  "infantsInSeat": 0,
  "infantsOnLap": 0,
  "maxRetries": 3,
  "proxyGroups": [
    "RESIDENTIAL"
  ]
}
```

# Actor output Schema

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

Dataset items with route metadata and a list of flight options.

# 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 = {
    "from": "TUN",
    "to": "CDG"
};

// Run the Actor and wait for it to finish
const run = await client.actor("mlika-gaith/google-flights-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 = {
    "from": "TUN",
    "to": "CDG",
}

# Run the Actor and wait for it to finish
run = client.actor("mlika-gaith/google-flights-scraper").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 '{
  "from": "TUN",
  "to": "CDG"
}' |
apify call mlika-gaith/google-flights-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=mlika-gaith/google-flights-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/4czQD3s2I71XK5CvJ/builds/YkFHZA8koPq15v96j/openapi.json
