Compilation of different scripts developed by me for Scriptable iOS app.
This widget uses Transport for London Unified API, and presents the nearest transport stations, the next trains and their destination.
In order to use it, you have to register to obtain a app_key
. In order to obtain the key, you have to subscribe to 500 Requests per min
product in Products tab.
There are two ways of importing this widget into your device:
- Import the widget using ScriptDude with the button below.
- Create a new widget manually and copy the content of the file
tfl-near-stations.js
into it.
Three variables can be customized:
-
const app_key = "API-TOKEN-HERE"
➡️ TFL API primary or secondary key, obtained after registering in their website. It's required that this token is included in the variable. The API can be used as anonymously for testing purposes, but it works much more slowly, requests can't be tracked and getting the token is just free.You can use either the primary key or your secondary key in the
app_key
parameter. There are two keys because you can use them in different apps, and if you need to revoke one key, then the apps using the other key can continue working. -
const stop_modes = ["tube", "elizabeth-line", "dlr"]
➡️ Stations modes, obtained from TFL StopPoint API.Available modes are:
["bus", "cable-car", "coach", "cycle", "cycle-hire", "dlr", "elizabeth-line", "interchange-keep-sitting", "interchange-secure", "national-rail", "overground", "replacement-bus", "river-bus", "river-tour", "taxi", "tram", "tube", "walking"]
-
const radius = 1000
➡️ Radius in meters from current location where stations will be searched.