Trainline Scraper
Pricing
from $3.00 / 1,000 results
Trainline Scraper
Scrape Trainline - the UK & Europe rail/bus metasearch. Journey search (origin → destination → date/time) with departure/arrival times, duration, changes, operator and fares; station autocomplete lookup; and popular routes with 'from' prices.
Pricing
from $3.00 / 1,000 results
Rating
0.0
(0)
Developer
Crawler Bros
Maintained by CommunityActor stats
0
Bookmarked
1
Total users
1
Monthly active users
12 days ago
Last modified
Categories
Share
Scrape Trainline — Europe's leading rail & bus ticket metasearch (UK, France, Germany, Italy, Spain and 40+ countries). Search train journeys between stations or cities, look up stations with codes and coordinates, and pull Trainline's own popular routes with "from" prices. Browser-based (Playwright) for the journey search flow, with public JSON endpoints for station lookup and popular routes. No login, no cookies required.
What this actor does
- Three modes:
search(journeys),stationLookup(station autocomplete),popularRoutes(curated route list) - Journey search: origin → destination → date → time, with departure/arrival times, duration, changes, operator, price and currency
- Reliable fallback: when the live fare engine blocks automated access, the actor automatically emits the server-rendered route summary (first/last train, average & fastest journey time, frequency, distance, price-from, operators) instead of failing
- Station autocomplete: names, station IDs, coordinates, countries, timezones and available connections
- Filters: depart-after / arrive-by times, ticket type (Standard / First / Season), max price
- Locales & currencies: 18 site locales and 24 ISO 4217 currencies
- Empty fields are omitted
Data Source
Trainline (www.thetrainline.com). Station lookup and popular routes come from Trainline's public JSON endpoints. Journey search runs the browser-based results flow.
Limitations
- Trainline's live fare engine (
/api/journey-search/) is protected by DataDome bot detection. From some datacenter IPs it returns a CAPTCHA challenge and no journeys. When this happens,searchmode automatically falls back to the server-rendered route-summary page, which is reliably accessible and still yields real data (first/last train, fastest & average journey time, trains per day, distance, price-from, operators). The summary fetch retries with backoff on transient 429/500s before giving up. To increase the chance of full per-journey fares (price per train, exact times), enable the optional Apify proxy — it is engaged automatically only when a block is detected (no extra cost on direct traffic). - The fallback record is marked
recordType: "journeySummary"; full per-journey records arerecordType: "journey". - Season-ticket filtering (
ticketType: "Season") only keeps journeys whose fare class is explicitly detected as seasonal — Trainline rarely exposes it per journey, so this filter may legitimately yield zero records. - Trainline requires a valid future travel date; past dates are clamped to today + 7 days.
- Origin and destination resolving to the same station return 0 records (Trainline serves no data for identical stations) with a clear status message.
- The
train-timessummary pages are locale-independent — thelocaleinput affects the station autocomplete and results page, not the summary URL (localized prefixes return 404).
Output
Per journey (recordType: "journey")
origin,destination— resolved station namesdepartureTime,arrivalTime—HH:MMdepartureDate—YYYY-MM-DDdurationMinutes,changesoperator— e.g.Avanti West Coastprice,currency— ISO 4217 (GBP,EUR, …)trainId,ticketType,fareClasssourceUrl,scrapedAt,recordType
Per journey summary (recordType: "journeySummary")
fromStation,toStation,fromSlug,toSlugfirstTrain,lastTrain— first/last departure times of the dayfastestJourneyMinutes,averageJourneyMinutesfrequencyPerDay,distanceMiles,distanceKmdirectTrainsOnly,priceFrom,currencyoperators[]sourceUrl,scrapedAt,recordType
Per station (recordType: "station")
stationId,stationUrn,name,shortName(e.g.EUS),countryCodelatitude,longitude,locationType,timezone,defaultLanguageparentName,subtitle,attributes[],connections[],matchScoresourceUrl— UK stations link to their/stations/<slug>page; other stations link to the public locations-search endpoint that produced them
Per popular route (recordType: "popularRoute")
originName,destinationName,priceFrom,currencydurationMinutes,trainTimesPath,trainTimesUrl,isReversesourceUrl,scrapedAt,recordType
Input
| Field | Type | Default | Description |
|---|---|---|---|
mode | string | search | search / stationLookup / popularRoutes |
originStation | string | London Euston | Departure station or city (mode=search) |
destinationStation | string | Birmingham New Street | Arrival station or city (mode=search) |
stationQuery | string | – | Station name to look up (mode=stationLookup) |
travelDate | date | today + 7 days | Journey date YYYY-MM-DD (mode=search) |
departAfter | string | – | Only journeys departing at/after HH:MM |
arriveBy | string | – | Only journeys arriving at/before HH:MM |
ticketType | string | – | Standard / First / Season |
maxPrice | int | – | Drop records priced above this |
locale | string | en-gb | Site locale (18 options) |
currency | string | GBP | ISO 4217 currency code (24 options) |
maxItems | int | 50 | Hard cap (1–200) |
proxyConfiguration | object | off | Optional Apify proxy, engaged automatically on block |
Example: journey search
{"mode": "search","originStation": "London Euston","destinationStation": "Birmingham New Street","travelDate": "2026-09-10","departAfter": "07:00","maxItems": 20}
Example: depart-after with filters
{"mode": "search","originStation": "Manchester Piccadilly","destinationStation": "London Euston","departAfter": "08:30","arriveBy": "13:00","ticketType": "Standard","maxPrice": 60,"currency": "GBP"}
Example: station lookup
{"mode": "stationLookup","stationQuery": "Birmingham"}
Example: popular routes
{"mode": "popularRoutes"}
Use cases
- Rail price monitoring — track "from" prices on popular UK/EU corridors
- Journey planning data — first/last trains, frequencies and durations for route research
- Station reference data — code, coordinates and connection lookups
- Competitive intelligence — corridor-level pricing intelligence for transport startups
- Content enrichment — route-level facts (distance, average time, operators) for travel sites
FAQ
What is the data source? Trainline (www.thetrainline.com), a UK/EU train & bus fare metasearch platform. This actor is a third-party tool and is not affiliated with or endorsed by Trainline.
Why did I get journeySummary records instead of journey records? Trainline's fare engine is protected by DataDome bot detection. When it challenges automated traffic, the actor automatically emits the route-summary record (server-rendered, always accessible) so you still get real data. Enable the optional proxy for a better chance at full per-journey fares.
Do I need an account or cookies? No. Everything this actor reads is public.
Are past dates allowed? No — Trainline only serves current/future journeys. Past dates are clamped to today + 7 days.
What currencies can I get? Prices are returned in the currency you select (24 ISO 4217 codes available). The currency field on every record is an ISO 4217 code.
Why are some fields missing? Empty fields are omitted by design. For example, not every journey card shows a trainId, and not every route page lists a priceFrom.
Is this free to run? The actor uses the free Playwright base image. The optional proxy is only used when a block is detected, so most runs cost nothing extra.
How fresh is the data? Live. Journey and route pages are fetched at run time.