I used to work at a place outside the city that only had one bus after work and it was kinda spotty and unreliable. However, there was an online API provided by the bus company that told me where the bus is.
So I wrote a Python script and a Linux alert that would give me a notification when the bus was within range, with enough time to get to the stop on time.
I found a webpage that uses it and found out that it requires no authentication. So I just copied the url and sent a request every 5 seconds just like the webpage did. It gave a csv of busses, their routes and gps locations.
It depends on the transit service, and how much their IT people suck. I’m pretty sure there have been multiple attempts to make standardized APIs for this sort of thing, but you shouldn’t necessarily expect them to be widely used except maybe in Europe.
Do a web search for “[transit service name] API” and start from there.
Edit: My local transit service apparently publishes a GTFS feed, which may be more widespread than I assumed, but I’m honestly kinda surprised they didn’t try to roll their own or something stupid like that.
I used to work at a place outside the city that only had one bus after work and it was kinda spotty and unreliable. However, there was an online API provided by the bus company that told me where the bus is.
So I wrote a Python script and a Linux alert that would give me a notification when the bus was within range, with enough time to get to the stop on time.
Can this be done for basically… any transit? How do you search for api url or stream feed? Its not anything like RSS is it?
I found a webpage that uses it and found out that it requires no authentication. So I just copied the url and sent a request every 5 seconds just like the webpage did. It gave a csv of busses, their routes and gps locations.
Ya but like how might I try to replicate that for a different transit service?
It depends on the transit service, and how much their IT people suck. I’m pretty sure there have been multiple attempts to make standardized APIs for this sort of thing, but you shouldn’t necessarily expect them to be widely used except maybe in Europe.
Do a web search for “[transit service name] API” and start from there.
Edit: My local transit service apparently publishes a GTFS feed, which may be more widespread than I assumed, but I’m honestly kinda surprised they didn’t try to roll their own or something stupid like that.
Aha sorry hehe