npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

live-flix-website-position

v2.0.0

Published

Periodically fetch a vehicle's position from Flix(bus)'s website.

Readme

live-flix-website-position

Periodically fetch a vehicle's position from Flix(bus)'s website.

npm version ISC-licensed minimum Node.js version support me via GitHub Sponsors chat with me via Matrix

Installation

npm install live-flix-website-position

Usage

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 = '162358de-ced8-471c-928f-af9197dd3f2f'

fetchTrip(rideUuid)

import {fetchTrip} from 'live-flix-website-position'

console.log(await fetchTrip(RIDE_UUID))
{
	id: '162358de-ced8-471c-928f-af9197dd3f2f',
	status: {
		segment: 1,
		next_stop_sequence: 2,
		has_arrived_at_next_stop: false,
		progress: 'IN_PROGRESS',
		deviation: {
			deviation_timestamp: '2025-09-05T11:02:24Z',
			deviation_seconds: -156,
			reason: null,
			deviation_class: 'ON_TIME',
			deviation_type: 'ESTIMATED',
			updated_at: '2025-09-05T10:36:24Z',
		},
		scheduled_timestamp: null,
	},
	platform: null,
	line: {
		code: '173',
		direction: 'Copenhagen Busterminal',
		name: 'Gothenburg - Copenhagen - Oldenburg',
		means_of_transport: 'BUS',
		brand: {
			id: 'a18f138c-68fa-4b45-a42f-adb0378e10d3',
			name: 'FlixBus',
		},
	},
	location: {
		coordinates: {
			latitude: 53.739532,
			longitude: 10.357351,
		},
		updated_at: '2025-09-05T10:44:05.837Z',
	},
	vehicle: {
		id: '6b6c9105-f089-435a-b6a0-11416f7e1bc8',
		license_plate: null,
		type: 'BUS',
	},
	calls: [
		{
			sequence: 1,
			stop: {
				id: 'dcbada9a-9603-11e6-9066-549f350fcb0c',
				type: 'BUS',
				timezone: 'Europe/Berlin',
				name: 'Hamburg central bus station',
				description: 'Gate information available here: https://www.zob-hamburg.de/abfahrt.php',
				city: {
					id: '40d91e53-8646-11e6-9066-549f350fcb0c',
					name: 'Hamburg',
				},
				code: 'HH',
				location: {
					latitude: 53.551767,
					longitude: 10.011657,
				},
			},
			arrival: null,
			departure: {
				scheduled: '2025-09-05T10:00:00Z',
				deviation: /* … */,
				platform: null,
			},
		},
		/* … */
		{
			sequence: 4,
			stop: {
				id: 'dcbd0b4b-9603-11e6-9066-549f350fcb0c',
				type: 'BUS',
				timezone: 'Europe/Copenhagen',
				name: 'Copenhagen Busterminal',
				/* … */
			},
			arrival: {
				scheduled: '2025-09-05T15:30:00Z',
				deviation: /* … */,
				platform: null,
			},
			departure: null,
		},
	],
}

fetchRoute(rideUuid)

import {fetchRoute} from 'live-flix-website-position'

console.log(await fetchRoute(RIDE_UUID))

The polyline fields contain Google-encoded polylines. You can use e.g. google-polyline to decode them.

{
	segments: [
		{
			segment_sequence: 1,
			polyline: 'emzeIatb|@AuAkEh@}Ak@y@eAiRwh@aEcNQkAVoAvEoKvDgGAeB}Kiu@_EgOwDcI_AqDcAyHcA_SIwHxA}|@nFe}@zAgIvAu@b@cCo@mDqCqAsGeNaCgI_BaNeCq`@_EmbAiIooA}JsdCRgZdDkf@lPkkAvKgl@rA{PwBmgA}@sMeF}\\eEgQwE_OkLqVyIeMguDsqEwKgLuIiGaNgGceAuS_LeDuKaH}IkJsxAwbCgGqMkIaYuSghAiFuP_DoHsNoUod@qp@iMaOoHaGurFgjD{dAqg@}m@w[sxDgbDy]k[syA_nBkHuMchAmdCqLiRgcAuxAoI{QstAcgDeGaLs[qe@sLoSiI}Q_JsX_GeWwEqZwCe[oAuWcBclDmAeb@cDm\\qMwm@}T__AeMsa@{|@myBcjBmhF_JsWem@urBc~@msCaH_SgKyS_BoFsAkNZ_BtCoDtHaG`Bo@lAFtG`QjUuRpCcDxPyZfCjFp@Tn@g@xB`IjADBrC',
		},
		// …
	],
}

fetchPosition(rideUuid)

fetchPosition() returns a geolocation with additional metadata. It returns null if there's no realtime data available.

import {fetchPositions} from 'live-flix-website-position'

console.log(await fetchPositions(RIDE_UUID))
{
	ride_uuid: '162358de-ced8-471c-928f-af9197dd3f2f',
	coordinates: {
		latitude: 53.739532,
		longitude: 10.357351,
	},
	updated: 1757069045,
	above_quality_threshold: null,
	to_stop_uuid: 'dcbbeac7-9603-11e6-9066-549f350fcb0c',
	vehicle_type: 'bus',
	stale: null,
}

positions(rideUuid)

positions() returns an async iterable, with each item having the same structure as fetchPosition(rideUuid)'s return value.

import {positions} from 'live-flix-website-position'

const resolveAfter = ms => new Promise(resolve => setTimeout(resolve, ms))

let i = 0
for await (const pos of positions(RIDE_UUID)) {
	console.log(i++, pos)
	await resolveAfter(5_000) // 5 seconds
}
0, {
	ride_uuid: '162358de-ced8-471c-928f-af9197dd3f2f',
	coordinates: {latitude: 53.739532, longitude: 10.357351},
	updated: 1757069045,
	above_quality_threshold: null,
	to_stop_uuid: 'dcbbeac7-9603-11e6-9066-549f350fcb0c',
	vehicle_type: 'bus',
	stale: null,
}
1 {
	ride_uuid: '162358de-ced8-471c-928f-af9197dd3f2f',
	coordinates: {latitude: 53.739533, longitude: 10.357352},
	updated: 1757069050,
	above_quality_threshold: null,
	to_stop_uuid: 'dcbbeac7-9603-11e6-9066-549f350fcb0c',
	vehicle_type: 'bus',
	stale: null,
}
// …

Related

Contributing

If you have a question or need support using live-flix-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.