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

Scrape one-way flights from Google Flights: airline, flight numbers, times, duration, stops, price, CO2 and every segment with aircraft and legroom. Any route and date, cabin class and passengers. One result per flight.

- **URL**: https://apify.com/distinct_readjustment/google-flights-scraper.md
- **Developed by:** [try mersianto](https://apify.com/distinct_readjustment) (community)
- **Categories:** Travel
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.20 / 1,000 flights

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

## Google Flights Scraper

Scrape one-way flights from [Google Flights](https://www.google.com/travel/flights) for any route and date. One result per flight: airline, flight numbers, departure and arrival times, duration, stops, total price, CO2 estimate, and every segment with aircraft and legroom. Choose cabin class, number of adults, maximum stops and currency. $4 per 1,000 flights on the Free plan, less on paid plans. No browser, so runs are fast and cheap.

### What you get

| Field | Type | Description |
| --- | --- | --- |
| `search` | string | Search as given in the input |
| `rank` | integer | Position of the flight in Google's results for that search, starting at 1 |
| `origin` | string | Departure airport IATA code |
| `destination` | string | Arrival airport IATA code |
| `departure_date` | string | Departure date, YYYY-MM-DD, local time |
| `departure_time` | string or null | Departure time, HH:MM, local time |
| `arrival_date` | string or null | Arrival date, YYYY-MM-DD, local time |
| `arrival_time` | string or null | Arrival time, HH:MM, local time |
| `duration_minutes` | integer or null | Total travel time including layovers, in minutes |
| `stops` | integer | Number of stops, 0 for nonstop |
| `airline` | string | Airline or airlines, comma separated |
| `flight_numbers` | array | Flight numbers of all segments, for example AA 171 |
| `price` | number | Total price for all adults, one way, in the currency given in currency |
| `currency` | string | Currency code of price |
| `cabin` | string | Cabin class searched: economy, premium_economy, business or first |
| `adults` | integer | Number of adult passengers searched |
| `co2_emissions_kg` | integer or null | Estimated CO2 emissions of this itinerary per passenger, kg |
| `typical_co2_emissions_kg` | integer or null | Typical CO2 emissions for this route, kg |
| `segments` | array | Each flight segment: flight_number, airline, from/to airport and name, departure/arrival date and time, duration_minutes, aircraft, legroom |
| `google_url` | string | Google Flights page of this search |
| `scraped_at` | string | UTC time the flight was scraped, ISO 8601 |

Times are local to each airport. `price` is the total for all adults in the search, one way.

### Input

- `searches`: one-way searches as `FROM TO YYYY-MM-DD` with IATA airport codes, for example `JFK LAX 2026-12-01`. For a return trip, add the return as a second search (`LAX JFK 2026-12-08`). Lines in another format are skipped and logged.
- `cabin`: `economy` (default), `premium_economy`, `business` or `first`.
- `adults`: 1 to 9 adult passengers. Default 1.
- `maxStops`: `any` (default), `nonstop`, `max_1_stop` or `max_2_stops`.
- `currency`: three-letter currency code, default `USD`.
- `maxItemsPerSearch`: stop a search after this many flights, in Google's order. Default 50.
- `maxItems`: stop after this many flights in total. Default 500.
- `proxyConfiguration`: fallback proxy, Apify datacenter by default. Each search is tried directly first.

```json
{
  "searches": ["JFK LAX 2026-12-01", "LAX JFK 2026-12-08"],
  "cabin": "economy",
  "adults": 1,
  "maxStops": "nonstop"
}
```

### Example output

```json
{
  "search": "JFK LAX 2026-12-01",
  "rank": 1,
  "origin": "JFK",
  "destination": "LAX",
  "departure_date": "2026-12-01",
  "departure_time": "21:27",
  "arrival_date": "2026-12-02",
  "arrival_time": "00:49",
  "duration_minutes": 382,
  "stops": 0,
  "airline": "American",
  "flight_numbers": [
    "AA 300"
  ],
  "price": 205,
  "currency": "USD",
  "cabin": "economy",
  "adults": 1,
  "co2_emissions_kg": 281,
  "typical_co2_emissions_kg": 343,
  "segments": [
    {
      "flight_number": "AA 300",
      "airline": "American",
      "from_airport": "JFK",
      "from_airport_name": "John F. Kennedy International Airport",
      "to_airport": "LAX",
      "to_airport_name": "Los Angeles International Airport",
      "departure_date": "2026-12-01",
      "departure_time": "21:27",
      "arrival_date": "2026-12-02",
      "arrival_time": "00:49",
      "duration_minutes": 382,
      "aircraft": "Boeing 787",
      "legroom": "31 in"
    }
  ],
  "google_url": "https://www.google.com/travel/flights/search?tfs=GhoSCjIwMjYtMTItMDFqBRIDSkZLcgUSA0xBWEABSAGYAQI&hl=en&curr=USD",
  "scraped_at": "2026-10-16T12:21:53+00:00"
}
```

### Pricing

Pay per result: one `flight` event per flight saved. The run stops cleanly when your maximum charge per run is reached. Searches that return no flights cost nothing beyond the start fee.

### Limitations

- One-way searches only. Round trips are two searches; Google's round-trip bundle prices are not included.
- Results are the flights Google lists on the first results page for a search, usually 20 to 100. Google's ranking and prices change often; a flight's price is a snapshot at `scraped_at`.
- Prices come from Google and may differ from the airline's final price (bags, fees).
- Airports must be given as IATA codes (JFK, LHR, CGK). City codes such as NYC are not supported.

### For AI agents

Minimal input:

```json
{ "searches": ["JFK LAX 2026-12-01"], "maxItemsPerSearch": 10 }
```

Each dataset item is one flight itinerary with the fields listed under "What you get"; `segments` lists each leg.

# Actor input Schema

## `searches` (type: `array`):

One-way searches as 'FROM TO YYYY-MM-DD' with IATA airport codes. Add a second search for the return. Example: JFK LAX 2026-12-01.

## `cabin` (type: `string`):

Cabin class for all searches.

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

Number of adult passengers. Prices are totals for all of them.

## `maxStops` (type: `string`):

Limit the number of stops.

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

Three-letter currency code for prices. Example: EUR.

## `maxItemsPerSearch` (type: `integer`):

Stop a search after this many flights, in Google's order. Google usually lists 20 to 100 flights per search.

## `maxItems` (type: `integer`):

Stop after this many flights in total.

## `proxyConfiguration` (type: `object`):

Fallback proxy. Each search is first tried directly; if that fails twice, 2 more attempts go through this proxy, each from a different IP.

## Actor input object example

```json
{
  "searches": [
    "JFK LAX 2026-12-01"
  ],
  "cabin": "economy",
  "adults": 1,
  "maxStops": "any",
  "currency": "USD",
  "maxItemsPerSearch": 10,
  "maxItems": 10,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

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

Flights with times, stops, price and segments.

# 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 = {
    "searches": [
        "JFK LAX 2026-12-01"
    ],
    "maxItemsPerSearch": 10,
    "maxItems": 10,
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("distinct_readjustment/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 = {
    "searches": ["JFK LAX 2026-12-01"],
    "maxItemsPerSearch": 10,
    "maxItems": 10,
    "proxyConfiguration": { "useApifyProxy": True },
}

# Run the Actor and wait for it to finish
run = client.actor("distinct_readjustment/google-flights-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 '{
  "searches": [
    "JFK LAX 2026-12-01"
  ],
  "maxItemsPerSearch": 10,
  "maxItems": 10,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}' |
apify call distinct_readjustment/google-flights-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,distinct_readjustment/google-flights-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/kSoPjuyxQaniiBRT6/builds/tzBtpHpLk7vyGiANV/openapi.json
