public-transport/hafas-client

DB: support "best price search"

Open

#291 opened on May 8, 2023

View on GitHub
 (11 comments) (0 reactions) (0 assignees)JavaScript (60 forks)github user discovery
enhancementhelp wantedprofile:db

Repository metrics

Stars
 (353 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

Both the Deutsche Bahn (DB) website as well as their app have a feature called "best price search" or "Bestpreissuche", which works just like the regular journeys() (TripSearch in HAFAS), except that it returns the lowest-price journeys for each time bracket.

The details of this BestPriceSearch call are documented at https://github.com/juliuste/db-prices/issues/33#issuecomment-1538776446 . It's response data looks like the one of a TripSearch call, but it also has a field res.outDaySegL that groups the journeys in res.outConL[] into time brackets.

Not sure how this functionality should be exposed:

  • We could let journeys() always parse & expose a grouping/bracketing of journeys as soon as the HAFAS response contains it. A DB-specific opt.bestPriceSearch option would use BestPriceSearch and outTime: "000000".
  • Within the DB profile, we could implement it as an entirely separate hafas-client method. It would have to share much of the logic with journeys(). Currently, we don't have a mechanism to let profiles add methods though.

pyhafas equivalent Issue: https://github.com/FahrplanDatenGarten/pyhafas/issues/26

Contributor guide