New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

db-vendo-client

Package Overview
Dependencies
Maintainers
0
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

db-vendo-client

Client for bahn.de public transport APIs.

  • 6.3.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
263
increased by43.72%
Maintainers
0
Weekly downloads
 
Created
Source

db-vendo-client

A client for the new "vendo"/"movas" bahn.de APIs, a drop-in replacement for hafas-client.

ISC-licensed support Jannis via GitHub Sponsors

This is a very early version. What works:

  • journeys(), refreshJourney() including tickets
  • locations(), nearby()
  • departures(), arrivals() boards
  • trip()

What doesn't work (yet, see TODO's scattered around the code):

  • journeys() details like scheduledDays, stop/station groups, some line details ...
  • loadFactor and other details in boards
  • certain stop details like products for locations() and geopositions and remarks for boards – this can be remedied by turning on enrichStations in the config, enriching location info with db-hafas-stations.
  • some query options/filters (e.g. routingMode for journeys, direction for boards)
  • all other endpoints (tripsByName(), radar(), journeysFromTrip(), reachableFrom(), remarks(), lines(), station())

Depending on the configured profile, db-vendo-client will use multiple different DB APIs that offer varying functionality, so choose wisely:

db Profiledbnav Profile
no API key required
max duration boards12h1h
remarksnot for boards✅ (still no remarks() endpoint)
cancelled tripsnot contained in boardscontained with cancelled flag
ticketsonly for refreshJourney()only for refreshJourney(), mutually exclusive with polylines
polylinesonly for trip()only for refreshJourney()/trip(), mutually exclusive with tickets
trip ids usedHAFAS trip ids for journeys, RIS trip ids for boards (static on train splits?)HAFAS trip ids
line.id/fahrtNr usedunreliable/route id for journeys/trip(), actual fahrtNr for boardsactual fahrtNr for journeys, unreliable/route id for boards and trip()
adminCode/operatoradminCode only for boardsonly for journeys
stop()
assumed backend API stabilityless stablemore stable

Feel free to report anything that you stumble upon via Issues or create a PR :)

Also consult the relevant documentation of hafas-client (but beware of the limited functionality of db-vendo-client).

Background

After DB has switched to the new "vendo"/"movas" platform for bahn.de and DB Navigator, the old HAFAS API (see hafas-client) seems to become less and less reliable (server unreachable, missing prices, etc.) This project aims to enable easy switching to the new APIs. However, not all information will be available from the new APIs.

Actually, db-vendo-client is a wrapper around multiple different APIs, currently the bahn.de API for route planning and the regio-guide RIS API for boards for the db profile and the DB Navigator API for the dbnav profile. See some notes about the various new APIs at DB.

Strictly speaking, permission is necessary to use this library with the DB APIs.

Usage

Use it as a dependency, e.g. just replacing hafas-client:

npm i db-vendo-client

See an example in api.js. It shows how you can use db-vendo-client together with hafas-rest-api in order to run a FPTF API server. The Dockerfile serves this API (using the dbnav profile):

docker run \
    -e USER_AGENT=my-awesome-program \
    -e DB_PROFILE=dbnav \
    -p 3000:3000 \
    ghcr.io/public-transport/db-vendo-client

There are community-maintained TypeScript typings available as @types/hafas-client.

Contributing

If you have a question, found a bug or want to propose a feature, please open an Issue.

This project needs help! Check the list of "help wanted" Issues.

If you're contributing code, please read the contribution guidelines.

Keywords

FAQs

Package last updated on 11 Jan 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc