It seems they route along roads between bus stops, so you won't get train routes that follow the tracks. But in principle the solution should be very similar.
If the routing is done with an internal database (rather than some roads-only API) it might be straightforward to use the railway lines from Open Street Map [1]. Or even the public transport routes recorded in OSM [2].