Deutsche Bahn Scraper - Train Schedules & Prices avatar

Deutsche Bahn Scraper - Train Schedules & Prices

Pricing

Pay per usage

Go to Apify Store
Deutsche Bahn Scraper - Train Schedules & Prices

Deutsche Bahn Scraper - Train Schedules & Prices

Scrape train connections, schedules, and prices from Deutsche Bahn (bahn.de). Extract ICE, IC, RE, and S-Bahn routes with departure/arrival times, duration, transfers, carriers, and live fares across Germany and Europe.

Pricing

Pay per usage

Rating

0.0

(0)

Developer

Studio Amba

Studio Amba

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

5 days ago

Last modified

Categories

Share

Deutsche Bahn Scraper

Scrape train connections, schedules, and prices from Deutsche Bahn (bahn.de), Germany's national railway operator with over 50 million monthly visitors. Extract ICE, IC, RE, RB, and S-Bahn routes with departure/arrival times, durations, transfer counts, platform numbers, carrier information, and live ticket fares.

No login or cookies required. The actor handles bahn.de's complex SPA and anti-bot protections automatically using residential proxies and a headless browser.

How to scrape Deutsche Bahn data

  1. Go to Deutsche Bahn Scraper on the Apify Store.
  2. Click Try for free to open the actor in Apify Console.
  3. Enter your origin and destination stations (e.g., "Berlin Hbf" to "München Hbf").
  4. Optionally set a departure date and time.
  5. Click Start and wait for the results.
  6. Download your data in JSON, CSV, Excel, or connect it directly to your workflow via API.

Why use this actor?

  • Comprehensive data — Get full connection details including train types, prices, platforms, transfer counts, and individual journey legs in a single run.
  • No login needed — Extracts publicly available schedule and pricing data without any Deutsche Bahn account.
  • Handles the SPA — bahn.de is a complex single-page application. This actor uses Playwright to properly render the page and extract data that simple HTTP scrapers miss.
  • Scheduled runs — Set up daily or hourly schedules to monitor price changes on your preferred routes.
  • API access — Integrate train data directly into your applications, dashboards, or business workflows using the Apify API.

Input

ParameterTypeDefaultDescription
originstringBerlin HbfDeparture station name. Partial names are resolved automatically.
destinationstringMünchen HbfArrival station name. Partial names are resolved automatically.
departureDatestringTomorrowSearch date in YYYY-MM-DD format.
departureTimestring08:00Earliest departure time in HH:MM format (24h).
travelClassstring2Travel class: 1 (First) or 2 (Second).
maxResultsinteger20Maximum number of connections to return (1-200).
proxyConfigurationobjectResidential DEProxy settings. Residential proxies with a German exit node are recommended.

Example input

{
"origin": "Berlin Hbf",
"destination": "München Hbf",
"departureDate": "2026-06-15",
"departureTime": "08:00",
"travelClass": "2",
"maxResults": 20,
"proxyConfiguration": {
"useApifyProxy": true,
"apifyProxyGroups": ["RESIDENTIAL"],
"apifyProxyCountry": "DE"
}
}

Output

The actor produces a dataset with one item per train connection. You can download the dataset in various formats such as JSON, HTML, CSV, or Excel.

Example output

{
"origin": "Berlin Hbf",
"destination": "München Hbf",
"departureTime": "2026-06-15T08:15:00+02:00",
"arrivalTime": "2026-06-15T12:10:00+02:00",
"duration": "3h 55min",
"durationMinutes": 235,
"trainType": "ICE",
"trainNumber": "ICE 1001",
"price": 29.90,
"currency": "EUR",
"travelClass": "2",
"transfers": 0,
"legs": [
{
"origin": "Berlin Hbf",
"destination": "München Hbf",
"departureTime": "2026-06-15T08:15:00+02:00",
"arrivalTime": "2026-06-15T12:10:00+02:00",
"trainType": "ICE",
"trainNumber": "ICE 1001",
"carrier": "DB Fernverkehr",
"departurePlatform": "6",
"arrivalPlatform": "12"
}
],
"carrier": "DB Fernverkehr",
"departurePlatform": "6",
"arrivalPlatform": "12",
"url": "https://int.bahn.de/en/buchung/fahrplanauskunft?...",
"scrapedAt": "2026-06-09T14:30:00.000Z"
}

Data fields

FieldTypeDescription
originstringDeparture station name
destinationstringArrival station name
departureTimestringISO 8601 departure timestamp
arrivalTimestringISO 8601 arrival timestamp
durationstringHuman-readable duration (e.g., "3h 55min")
durationMinutesnumberDuration in minutes for easy sorting/filtering
trainTypestringPrimary train category: ICE, IC/EC, RE/RB, S-Bahn, TGV, etc.
trainNumberstringFull train identifier (e.g., "ICE 1001")
pricenumberTicket price in EUR (0 if not available)
currencystringAlways "EUR"
travelClassstringTravel class searched (1 or 2)
transfersnumberNumber of transfers/changes
legsarrayIndividual trip segments with per-leg train details
carrierstringOperating railway company (e.g., "DB Fernverkehr")
departurePlatformstringDeparture platform/track number
arrivalPlatformstringArrival platform/track number
urlstringDirect link to this connection on bahn.de
scrapedAtstringISO 8601 timestamp of when the data was collected

How much does it cost to scrape Deutsche Bahn?

The actor uses Playwright with residential proxies, which consumes approximately 0.2-0.5 compute units per run for a typical search of 20 connections. That translates to roughly $0.05-$0.12 per run at standard Apify pricing. Running daily monitoring on a single route would cost approximately $1.50-$3.60 per month.

For high-volume usage, increase maxResults and use the pagination feature to get more connections per run rather than running multiple separate searches.

Tips

  • Use German station names for best results. "München Hbf" works better than "Munich Central".
  • Prices may not always be available — Deutsche Bahn shows prices dynamically and some connections may return a price of 0. This typically means the fare is not yet released or sold out.
  • Schedule runs during off-peak hours for the most reliable results.
  • Residential proxies with a German exit node (DE) are strongly recommended. bahn.de has Akamai protection that blocks datacenter IPs.
  • Search ahead — Deutsche Bahn releases tickets 6 months in advance. Earlier searches tend to show lower "Sparpreis" fares.

FAQ

This actor extracts publicly available train schedule and pricing data from bahn.de. The data is accessible to any visitor without login. Always review Deutsche Bahn's Terms of Service and ensure your use case complies with applicable laws and regulations.

Why are some prices showing as 0?

Deutsche Bahn loads prices dynamically and some fare classes may not be available for all connections. A price of 0 means the fare was not displayed on the search results page. Try searching for a closer departure date when prices are more likely to be published.

The actor returned no results — what should I do?

  • Make sure your station names are valid German station names (e.g., "Frankfurt (Main) Hbf" not "Frankfurt Airport").
  • Check that your departure date is in the future.
  • Ensure you are using residential proxies with a German exit node.
  • Try a popular route like "Berlin Hbf" to "München Hbf" to verify the actor is working.

Can I scrape international routes?

Yes, Deutsche Bahn covers international connections to Austria, Switzerland, France, Netherlands, Belgium, Czech Republic, Poland, Denmark, and more. Enter the destination as it appears on bahn.de (e.g., "Wien Hbf", "Zürich HB", "Paris Est").

Support

If you encounter any issues or have feature requests, please open an issue in the Issues tab. For custom solutions or bulk data needs, reach out via the Apify platform.