Flight price scraping
Scraping flight prices means running fare searches on airline websites and online travel agencies and recording each fare by route, date, cabin and fare class. Zenrows fills the search form, gets through Akamai and other airline protection, and returns results as JSON or captured API responses for fare tracking and alerts.
Updated
{
"search": {
"origin": "JFK",
"destination": "LHR",
"depart": "2026-12-18",
"return": "2027-01-04",
"passengers": 1,
"cabin": "economy",
"point_of_sale": "us"
},
"source": "airline.example.com",
"searched_at": "2026-10-17T07:40:00Z",
"currency": "USD",
"itineraries": [
{ "flights": ["XX101", "XX118"], "stops": 0, "fare_brand": "Basic", "fare_class": "N", "price": 684.0, "seats_left": 4, "bag_included": false },
{ "flights": ["XX101", "XX118"], "stops": 0, "fare_brand": "Main", "fare_class": "L", "price": 789.0, "seats_left": null, "bag_included": true },
{ "flights": ["XX205", "XX230"], "stops": 1, "fare_brand": "Main", "fare_class": "Q", "price": 712.0, "seats_left": 7, "bag_included": true }
],
"award": { "program": "Example Miles", "cabin": "business", "miles": 57500, "taxes": 5.6, "available": true },
"lowest_price": 684.0
}
searched_at and point_of_sale per fare: prices change by day and country.What flight price teams collect
Fare data is a grid of route, dates, cabin and passengers, run against each seller.
Jobs differ in which part matters and how fast it refreshes.
| Job | Data you collect | Typical sources |
|---|---|---|
| Fare tracking and price alerts | Lowest fare per route and date, several times a day | |
| Award seat alerts | Miles, taxes and availability by cabin | Loyalty programs: LATAM Pass, Smiles, AAdvantage |
| Airline revenue benchmarking | Rival fares by fare brand and class on shared routes | United, Lufthansa, Turkish Airlines, British Airways, Air India |
| OTA versus direct price checks | One itinerary priced on the airline and on OTAs | Airline sites, |
| Holiday package pricing | Flight plus hotel price by departure airport and date | TUI, Virgin Atlantic Holidays |
| Fare history datasets | Daily snapshots per route for forecasting | Any of the above, stored for months |
Why airline websites block flight scrapers
Every search costs the airline money, so it is guarded hard: bot management like Akamai, sometimes a challenge page before results.
Works a day or two, then access denied on every request
Zenrows' stealth and retries get through Akamai and similar
No fares until you type airports, pick dates and search
Page actions submit the form in Fetch; Browser drives longer flows with Playwright
Results drawn from JSON, not parseable HTML
Fetch captures the XHR calls; read the fare JSON directly
A CAPTCHA or Turnstile page instead of results
Adaptive Stealth Mode escalates to rendering and stealth and gets the search through
One seat, different prices by country and currency
Geotargeting searches from the country you track
Miles availability for signed-in members only
A Browser session keeps cookies from login to search
How to scrape flight prices with Zenrows
- Pick routes and dates: airport pairs, dates, cabin, passengers; build URLs where the search lives in the URL.
- Run the search: URLs to Fetch with Adaptive Stealth Mode; forms with page actions that fill airports and dates and click search.
- Read the fares from the captured fare response, or with CSS selectors on the results.
- Use Browser for long flows: logins, award calendars, multi-page booking, with Playwright or Puppeteer.
- Repeat on a schedule: the URL grid in Batch, each fare stored with time and market.
# pip install requests
import json
import requests
AIRLINE_SEARCH_URL = "https://airline.example.com/search" # placeholder
instructions = [
{"wait_for": "#origin"},
{"fill": ["#origin", "JFK"]},
{"fill": ["#destination", "LHR"]},
{"fill": ["#depart-date", "2026-12-18"]},
{"click": "button[type='submit']"},
{"wait_for": ".fare-results"},
]
params = {
"apikey": "YOUR_ZENROWS_API_KEY",
"url": AIRLINE_SEARCH_URL,
"js_render": "true",
"premium_proxy": "true",
"proxy_country": "us",
"js_instructions": json.dumps(instructions),
"json_response": "true", # returns the fare API calls the page made
}
response = requests.get("https://api.zenrows.com/v1/", params=params)
print(response.json())// npm install playwright
import { chromium } from "playwright";
const LOYALTY_LOGIN_URL = "https://airline.example.com/login"; // placeholder
const AWARD_SEARCH_URL = "https://airline.example.com/award-search?from=GRU&to=LIS&date=2026-12-18";
const browser = await chromium.connectOverCDP(
"wss://browser.zenrows.com?apikey=YOUR_ZENROWS_API_KEY&proxy_country=br"
);
const page = await browser.newPage();
// Capture the award search response instead of parsing the page
page.on("response", async (res) => {
if (res.url().includes("/award-search")) console.log(await res.json());
});
await page.goto(LOYALTY_LOGIN_URL);
await page.fill("#member-id", process.env.MEMBER_ID);
await page.fill("#password", process.env.MEMBER_PASSWORD);
await page.click("button[type='submit']");
await page.goto(AWARD_SEARCH_URL); // route, date and cabin in the URL
await page.waitForSelector(".award-calendar");
await browser.close();npx -y @zenrows/cli init
# A URL-driven search, rendered from the US market
zenrows fetch "FLIGHT_SEARCH_URL" --proxy-country us --wait-for ".fare-results" --output markdown
# The full route and date grid as one job
zenrows batch create fare-grid.jsonl --wait
zenrows batch results JOB_ID --out fares.jsonl# Connect once
claude mcp add zenrows -e ZENROWS_API_KEY=YOUR_ZENROWS_API_KEY -- npx -y @zenrows/mcp
# Then ask:
Use Zenrows to open Google Flights, search a one-way economy flight for one adult from JFK to LHR on 18 December 2026, and return the five cheapest options with airline, departure and arrival times, stops and price in USD.Which Zenrows product fits
- Price a route via searchable URLs FetchOne request, the results or the fare JSON
- Fill an airline's search form in one request Fetch with page actionsFills airports and dates, searches, waits for results
- Search award seats behind logins or multi-step flows BrowserA real browser driven by Playwright or Puppeteer
- Refresh thousands of route-date searches daily BatchThe full grid as one job, results by webhook
What success looks like
| Measure | What good looks like | How to check it |
|---|---|---|
| Search success per airline | Most searches return fares, per carrier, not averaged | Successes over attempts per airline, per day |
| Fare match | The stored fare is what a traveller sees in that market | Re-run a sample by hand; compare price and fare brand |
| Alert lead time | Drops reach users within one cycle | Time from searched_at to alert |
| Grid coverage | A fare or explicit no-availability in every cell | Empty cells per carrier, per run |
| Response time | Fast enough for on-demand checks | Response time per request |
| Grid run time | The grid finishes inside one refresh window | Start and end time of each Batch job |
Flight price scraping FAQ
-
Start from the airline's or OTA's search: a URL with route and dates goes to Fetch with Adaptive Stealth Mode; a form gets page actions that fill it and search. Read fares from captured background calls or with CSS selectors.
-
Yes. It renders with JavaScript: use Adaptive Stealth Mode, geotargeted to your market. A common pattern: find the cheapest seller there, then price that airline directly for fare class and baggage.
-
Each search hits a costly reservation system, so airlines guard it, often with Akamai, which learns patterns over days, then blocks. Fares load from background calls, sometimes behind a challenge. Adaptive Stealth Mode escalates only when needed.
-
Airline distribution APIs and GDS access need commercial agreements and rarely include award seats, web-only fares or OTA prices. A tracker built on Zenrows returns what each site shows the public, for any route and market.
-
Yes. Award searches often need a loyalty login: in a Browser session, sign in with your own credentials, search and capture the response. Store miles, taxes and cabin per date and alert when seats open.
-
A fixed grid of routes, dates and markets in Batch: several times a day close in, daily months out. Store search time, point of sale and fare brand; alert on change from the last run, not a fixed price.
-
Public fares shown without login are widely collected for comparison and research. Read each airline's terms, sign in only to accounts you may use, keep volumes reasonable, and check with your legal team.