live-vy-website-position
v1.0.0
Published
Fetch a vehicles' realtime positions from Vy's website.
Maintainers
Readme
live-vy-website-position
Fetch vehicles' positions from Vy's website.
Installation
npm install live-vy-website-positionUsage
The Flix(bus) live tracking APIs work with trip-unique (Flix calls a trip a "ride") IDs. You must obtain the ID of your trip from another data source, e.g. the Flix(bus) website or one of their invoices.
const RIDE_UUID = '3d4d1d35-e72e-4fbf-b752-7268d12d0d4d'fetchLines()
import {fetchTrip} from 'live-vy-website-position'
console.log(await fetchLines())[
{name: 'VY1 Notodden-Oslo', value: 'VY1'},
{name: 'VY6 Hvaler-Fredrikstad-Oslo', value: 'VY6'},
{name: 'VY123 Elverum-Oslo', value: 'VY123'},
{name: 'VY146 Måløy/Ulsteinvik-Stryn-Oslo', value: 'VY146'},
{name: 'VY148 Ålesund-Oslo', value: 'VY148'},
{name: 'VY170 Førde-Sogndal-Oslo', value: 'VY170'},
{name: 'VY175 Geilo-Oslo', value: 'VY175'},
{name: 'VY177 Hallingdal-Oslo', value: 'vy177'},
{name: 'VY190 Ulsteinvik-Bergen-Kristiansand-Oslo', value: 'VY190'},
{name: 'VY430 Bergen-Førde-Ålesund', value: 'VY430'},
{name: 'VY450 Bergen-Fagernes-Oslo', value: 'VY450'},
{name: 'VY710 Lillehammer-Trondheim-Bodø', value: 'VY710'},
{name: 'FB11 Fredrikstad-Oslo Lufthavn (OSL)', value: 'FB11'},
{name: 'FB65 Flybussen Moa-Ålesund-Vigra', value: 'FB65'},
{name: 'S22 Shuttle Oslo lufthavn', value: 'S22'},
{name: 'S44 Shuttle Oslo lufthavn', value: 'S44'},
{name: 'S55 Shuttle Oslo lufthavn', value: 'S55'},
{name: '150 Lidköping-Stockholm', value: '150'},
{name: '300 Köpenhamn - Oslo', value: '300'},
{name: '200 Kalmar - Arlanda', value: '200'},
{name: '400 Stockholm - Göteborg', value: '400'},
{name: '700 Kalmar - Stockholm', value: '700'},
{name: '500 Stockholm - Göteborg', value: '500'},
{name: '600 Köpenhamn-Oslo', value: '600'},
{name: '700 Ludvika - Stockholm', value: '700'},
{name: '850 Oslo - Arlanda - Stockholm', value: '850'},
{name: '900 Oslo - Arlanda - Stockholm', value: '900'},
{name: '939 Karlstad - Nässjö', value: '939'},
{name: '360 Gol - Hemsedal (Tuv)', value: '360'},
]fetchTripPositions(lineNo = null, bookingNo = null)
You must pass either a lineNo or a bookingNo.
[!WARNING]
Their API seems to have various problems with date & time (zones). Last time I checked,{Planned,Actual}{Departure,Arrival}TimeZonewas wrong sometimes, etc.
import {fetchTripPositions} from 'live-vy-website-position'
console.log(await fetchTripPositions('600')) // Köpenhamn-Oslo [
{
RouteStops: [
{
IsRouteFirstStop: true,
IsRouteLastStop: false,
HasBusPassed: true,
BusStopName: 'Copenhagen bus terminal (Dybbølsbro)',
PlannedDepartureTime: '2025-08-26T13:15:00Z',
ActualDepartureTime: '2025-08-26T13:20:00Z',
PlannedArrivalTime: '2025-08-26T13:15:00Z',
ActualArrivalTime: '2025-08-26T13:15:00Z',
// …
},
// …
{
IsRouteFirstStop: false,
IsRouteLastStop: true,
HasBusPassed: false,
BusStopName: 'Oslo bussterminal',
PlannedDepartureTime: '2025-08-26T21:20:00Z',
ActualDepartureTime: '2025-08-26T22:30:00Z',
PlannedArrivalTime: '2025-08-26T21:20:00Z',
ActualArrivalTime: '2025-08-26T22:30:00Z',
// …
},
],
// …
TripId: 4051975,
LineNumber: '600',
BrandName: 'Vy bus4you',
SubContractorName: null,
Locations: [
{
LastKnownLatitude: '58.448420',
LastKnownLongitude: '11.672980',
LastKnownDirection: 311,
LocationTimeInUtc: '2025-08-26T18:18:03.78988Z',
TripDelayInMinutes: 75,
// …
},
],
},
// …
]tripPositions(lineNo = null, bookingNo = null)
You must pass either a lineNo or a bookingNo.
tripPositions() returns an async iterable, with each item having the same structure as the items of the array returned by fetchTripPositions().
import {tripPositions} from 'live-vy-website-position'
let i = 0
for await (const pos of tripPositions('600')) {
console.log(i++, pos)
}Related
live-flix-position– Live vehicle geolocation, taken from Flix(bus)'s website.live-icomera-position– Live vehicle geolocation, taken from the on-board Icomera WiFi system.live-gomedia-position– Live vehicle geolocation, taken from the GoMedia on-board WiFi entertainment system.live-cd-wifi-position– Live vehicle geolocation of Czech Railways trains, taken from the on-board WiFi system.wifi-on-ice-position-stream– A stream of positions of German Railways ICE trains, taken from the on-board WiFi.
Contributing
If you have a question or need support using live-vy-website-position, please double-check your code and setup first. If you think you have found a bug or want to propose a feature, use the issues page.
