All Projects → juliuste → db-prices

juliuste / db-prices

Licence: ISC license
Find journey prices using the DB Sparpreise API.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to db-prices

korail
Client for the South Korean korail railway API.
Stars: ✭ 47 (-42.68%)
Mutual labels:  railway, public-transport
comboios
Comboios de Portugal (CP, Portugese Railways) API client.
Stars: ✭ 32 (-60.98%)
Mutual labels:  railway, public-transport
interrail
Find european train stations and routes. Client for the European Interrail / EuRail API.
Stars: ✭ 24 (-70.73%)
Mutual labels:  railway, public-transport
oebb
Austrian Federal Railways (ÖBB) API client.
Stars: ✭ 40 (-51.22%)
Mutual labels:  railway, public-transport
sdk
🔧 TypeScript SDK for Entur APIs
Stars: ✭ 36 (-56.1%)
Mutual labels:  public-transport
osrd
Open Source Railway Designer
Stars: ✭ 54 (-34.15%)
Mutual labels:  railway
grafikon
Timetables for model railway. Useful for meets with modules (like FREMO, Free-mo etc).
Stars: ✭ 19 (-76.83%)
Mutual labels:  railway
gtfstools
General Transit Feed Specification (GTFS) Editing and Analysing Tools
Stars: ✭ 31 (-62.2%)
Mutual labels:  public-transport
realtime-transport-dashboards
Serverless APIs for AWS to build and display public transports real time data (Serverless application example)
Stars: ✭ 23 (-71.95%)
Mutual labels:  public-transport
ideas
How to make public transport more comfortable, more accessible, more transparent?
Stars: ✭ 35 (-57.32%)
Mutual labels:  public-transport
Next-Station-iOS
Source code of Next Station iOS app, available on App Store for downloading.
Stars: ✭ 15 (-81.71%)
Mutual labels:  railway
Railroad and Obstacle detection
This program detect and identify obstacle on railway. If program detect some obstacle that train must stop, program gives you warning sign. This program Also estimate riskiness of obstacle how it is negligible or not. We provide many models to you to detect railways and obstacles.
Stars: ✭ 14 (-82.93%)
Mutual labels:  railway
linked-connections-server
Express based server that exposes Linked Connections.
Stars: ✭ 12 (-85.37%)
Mutual labels:  public-transport
3D-Public-Transport-Simulator
The 3D Public Transport Simulator is a Unity-based simulation, which uses OpenStreetMap data in order to support the simulation of worldwide locations. The development was part of a Bachelor thesis.
Stars: ✭ 87 (+6.1%)
Mutual labels:  public-transport
raptor
Implementation of the Route Based Public Transit Algorithm (Raptor)
Stars: ✭ 64 (-21.95%)
Mutual labels:  public-transport
MMM-PublicTransportBerlin
MagicMirror module to display public transport in Berlin and Brandenburg with BVG Hafas data.
Stars: ✭ 37 (-54.88%)
Mutual labels:  public-transport
european-transport-operators
NOT UP-TO-DATE ANYMORE, UNMAINTAINED. CHECK european-transport-feeds INSTEAD. List of european long-distance transport operators, available API endpoints, GTFS feeds and client modules.
Stars: ✭ 47 (-42.68%)
Mutual labels:  public-transport
github client
Open source bot telegram menggunakan bahasa code dart
Stars: ✭ 24 (-70.73%)
Mutual labels:  railway
waline
💬 A Simple, Safe Comment System
Stars: ✭ 1,145 (+1296.34%)
Mutual labels:  railway
cli
Railway CLI
Stars: ✭ 167 (+103.66%)
Mutual labels:  railway

db-prices

JavaScript module for finding the cheapest railway connections using the Deutsche Bahn Sparpreise API. Inofficial, using an endpoint by Deutsche Bahn. Ask them for permission before using this module in production.

npm version Build Status Greenkeeper badge dependency status license chat on gitter

Installation

npm install db-prices

Usage

prices() returns a Promise that will resolve with a list of offers.

const prices = require('db-prices')

prices(from, to, [date], [opt]).then()

from and to must be station IDs like '8000105'. date must be a Date object; if empty, the current datetime will be used.

With opt, you can override the default options, which look like this:

{
	class: 			2, 	// 1st class or 2nd class
	noICETrains: 		false,
	transferTime: 		0, 	// in minutes
	duration: 		1440, 	// search for routes in the next n minutes
	preferFastRoutes: 	true,
	travellers: [{ 		// one or more
		bc:	0, 	// BahnCard ID (see https://gist.github.com/juliuste/202bb04f450a79f8fa12a2ec3abcd72d)
		typ: 	"E", 	// E: adult: K: child; B: baby -- BUG: child and baby dont work ATM
		alter: 	30 	// age
	}],
}

Response

The result will be a list of Friendly Public Transport Format journey objects.

With from = '8000105', to = '8011160' and date = new Date('2016-08-17T00:00:00.000Z'), the result looked like this:

[
	{
		type: 'journey',
		id: '0',
		origin: {
			type: 'station',
			id: '8000105',
			name: 'Frankfurt(Main)Hbf'
		},
		destination: {
			type: 'station',
			id: '8098160',
			name: 'Berlin Hbf (tief)'
		},
		legs: [{
			origin: {
				type: 'station',
				id: '8000105',
				name: 'Frankfurt(Main)Hbf'
			},
			departure: '2017-06-05T08:53:00.000Z',
			departurePlatform: '13',
			destination: {
				type: 'station',
				id: '8098160',
				name: 'Berlin Hbf (tief)'
			},
			arrival: '2017-06-05T13:17:00.000Z',
			arrivalPlatform: '7',
			line: {
				type: 'line',
				id: 'ice-1537',
				name: 'ICE 1537',
				product: 'ICE'
			}
		}],
		price: {
			currency: 'EUR',
			amount: 126,
			discount: false,
			name: 'Flexpreis',
			description: 'Fully flexible (not bound to a specific train / not dependent on the connection indicated on the selected route). Exchanges and refunds free of charge; on or after the first day of validity subject to a fee.'
		},
		nightTrain: false
	}
	// …
]

Similar Projects

Contributing

If you found a bug, want to propose a feature or feel the urge to complain about your life, feel free to visit the issues page.

Cheers to Jannis R for contributing.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].