OrbTop

Indonesia Transit Scraper — KAI Stations & TransJakarta BRT

TRAVELBUSINESSDEVELOPER TOOLS

Indonesia Transit Scraper — KAI Stations & TransJakarta BRT

Extract Indonesian public transit data from two verified public sources:

  • KAI (PT Kereta Api Indonesia) — complete station catalog: 217 stations across Java, Sumatra, and Sulawesi. Each record includes the 3-letter station code, full name, city, and regional classification.
  • TransJakarta BRT — all corridor listings from Jakarta's bus rapid transit network (one of the world's longest BRT systems). Each record includes corridor number, direction, and a link to the official route map image.

Output Fields

Field Description
record_type kai_station or transjakarta_route
operator KAI or TransJakarta
service_type intercity_rail or brt
station_code KAI 3-letter station code (e.g. GMR, BD, SBI)
station_name Full station name (e.g. GAMBIR, BANDUNG)
city City name
city_code Internal city identifier from KAI catalog
region Kabupaten / kota administrative region
line TransJakarta corridor (e.g. 1 | BLOK M - KOTA)
direction Route direction text
route_map_url URL to TransJakarta official corridor map image
source_url Source URL for the record
scraped_at ISO 8601 scrape timestamp

Input

Parameter Type Default Description
operator select any Filter by source: any, kai, or transjakarta
maxItems integer 15 Cap on total records returned

Data Sources

KAI Stations: The actor fetches booking.kai.id/api/stations2 (KAI's official booking portal JSON API). This endpoint returns the complete station catalog without authentication. A CSRF token is extracted from the booking portal home page and included in the request as required.

TransJakarta BRT: The actor fetches transjakarta.co.id/peta-rute and parses the corridor listing from HTML. Each corridor is identified by a data-caption attribute in the format "N | DIRECTION" with a link to the official route map image hosted at smk.transjakarta.co.id.

What's Not Covered

Several sources from the original spec were investigated but are out of scope:

  • KAI train schedules — the /search endpoint is behind a Cloudflare managed challenge
  • Pelni inter-island shipspelni.co.id was unreachable (connection timeout) at build time
  • Whoosh KCIC, MRT Jakarta, LRT Jabodebek, RedBus — all use JavaScript SPAs with no accessible public API surface

Usage

For the complete KAI station catalog (217 stations), set maxItems to 250 or higher. For all TransJakarta corridors (31 routes), set maxItems to 50 or higher after selecting the transjakarta operator.

The default maxItems: 15 is designed for fast test runs.