fast-flights — A Python API for Google Flights (via Protobuf Reverse Engineering)
Google killed their Flights API in 2018. But Google Flights the website still exists. So naturally, someone reverse-engineered it.
fast-flights is a Python library that lets you search Google Flights programmatically — one-way, round-trip, or multi-city — with full filtering support.
GitHub: AWeirdDev/flights
PyPI: pip install fast-flights
The Origin Story (It’s Good)
The author was building a chat-based trip recommendation app and wanted flight search. They looked for APIs:
“The results? Bad. It seems like they discontinued this service and it now lives in the Graveyard of Google.”
Existing scrapers on PyPI used Playwright — “slow… extremely slow” — and broke constantly.
So they looked at Google Flights URLs:
https://www.google.com/travel/flights/search?tfs=CBwQAhoeEgoyMDI0LTA1LTI4agcIARID...
That tfs parameter looked suspiciously like Base64. Decoding it gave garbled text with recognizable dates. Google’s JSON alternative? Protocol Buffers.
Running it through a protobuf decoder worked. The rest was writing the encoder.
Basic Usage
from fast_flights import (
FlightQuery,
Passengers,
create_query,
get_flights
)
query = create_query(
flights=[
FlightQuery(
date="2026-09-15",
from_airport="JFK",
to_airport="LHR",
),
],
seat="economy", # business/economy/first/premium-economy
trip="one-way", # multi-city/one-way/round-trip
passengers=Passengers(adults=1),
)
result = get_flights(query)
Full Filtering
Each flight leg supports granular filters:
flight = FlightQuery(
date="2026-09-15",
from_airport="JFK",
to_airport="LHR",
max_stops=1,
airlines=["BA", "AA", "ONEWORLD"],
earliest_departure_hour=7,
latest_departure_hour=18,
earliest_arrival_hour=10,
latest_arrival_hour=23,
max_duration_minutes=720,
connecting_airports=["ORD", "BOS"],
min_layover_minutes=60,
max_layover_minutes=240,
less_emissions_only=True,
)
Search-wide filters go in create_query:
query = create_query(
flights=[flight],
currency="USD",
max_price=1500,
carry_on_bags=1,
checked_bags=1,
hide_separate_and_self_transfer=True,
exclude_basic_economy=True,
)
Hours use local airport time (0-23). Duration and layover are in minutes.
Integrations for Production Use
The library supports proxy integrations to avoid IP blocks:
BrightData (proxy rotation):
from fast_flights.integrations import BrightData
result = get_flights(
query,
integration=BrightData(zone="your_zone")
)
SearchApi (richer data):
from fast_flights.integrations import SearchApi, SearchApiResult
result: SearchApiResult = get_flights(
query,
integration=SearchApi()
)
# Rich structured data
result.flights
result.cheaper_alternatives
result.price_insights
result.booking_options
What You Can Build
- Price trackers — monitor routes and alert on drops
- Travel assistants — chatbots that search flights naturally
- Comparison tools — aggregate across date ranges
- AI travel apps — let agents plan trips with real availability
- Research tools — analyze pricing patterns, route availability
Technical Details
v3.0 switched from HTML parsing to JavaScript data extraction — more reliable and faster. The library handles:
- Encoding your query into Google’s protobuf format
- Making the request
- Parsing the response back into typed Python objects
No Playwright by default (there’s an optional fallback for edge cases).
Limitations to Know
- This is scraping, not an official API — Google could change things
- Heavy use might get rate-limited (use integrations for production)
- Google applies the first leg’s airline filter to the whole search
Quick Start
pip install fast-flights
from fast_flights import FlightQuery, Passengers, create_query, get_flights
result = get_flights(create_query(
flights=[FlightQuery(date="2026-10-01", from_airport="SFO", to_airport="NRT")],
passengers=Passengers(adults=2),
trip="round-trip",
))
for flight in result.flights:
print(f"{flight.airline} - ${flight.price} - {flight.duration}")
The Takeaway
When Google kills an API but keeps the product, the data is still there — just encoded differently. Protocol Buffers are meant for efficiency, not obscurity. Someone willing to decode the format can rebuild the API.
fast-flights did exactly that. Clean Python interface, strong typing, full filter support. If you need programmatic Google Flights access, this is currently your best option.
Links: