Documentation ¶
Overview ¶
caltrain provides realtime train timings for various train stations in both directions. It does so by scraping the Caltrain mobile page.
Note, Caltrain alerts are not reflected in train timings.
Please don't abuse this api.
Example:
package main import ( "github.com/sent-hil/caltrain-realtime" ) func main() { timings, err := caltrain.GetRealTimings(caltrain.SanFrancisco, caltrain.SouthBound) }
Index ¶
Constants ¶
View Source
const ( // direction of trains SouthBound Direction = 0 NorthBound Direction = 1 // list of train strations as of June 1, 2016 SanFrancisco Station = "sanfrancisco" TwentySecondStreet Station = "22ndstreet" Bayshore Station = "bayshore" SouthSanFrancisco Station = "southsanfrancisco" SanBruno Station = "sanbruno" MillbraeTransitCenter Station = "millbraetransitcenter" Broadway Station = "broadway" Burlingame Station = "burlingame" SanMateo Station = "sanmateo" HaywardPark Station = "haywardpark" Hillsdale Station = "hillsdale" Belmont Station = "belmont" SanCarlos Station = "sancarlos" RedwoodCity Station = "redwoodcity" Atherton Station = "atherton" MenloPark Station = "menlopark" PaloAlto Station = "paloalto" CaliforniaAve Station = "californiaave" SanAntonio Station = "sanantonio" MountainView Station = "mountainview" Sunnyvale Station = "sunnyvale" Lawrence Station = "lawrence" SantaClara Station = "santaclara" CollegePark Station = "collegepark" SanJoseDiridon Station = "sanjosediridon" Tamien Station = "tamien" Capitol Station = "capitol" BlossomHill Station = "blossomhill" MorganHill Station = "morganhill" SanMartin Station = "sanmartin" Gilroy Station = "gilroy" )
Variables ¶
This section is empty.
Functions ¶
func GetRealTimings ¶
GetRealTimings returns duration of latest trains arriving at the specified station and going the specified direction. The Caltrain realtime page provides maximum of 3 upcoming trains.
See http://www.caltrain.com/schedules/realtime/stations.html for list of stations.
See http://www.caltrain.com/schedules.html if you want scheduled timetables.
TODO: incorporate alerts which are embedded in the page.
Types ¶
Click to show internal directories.
Click to hide internal directories.