-
-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DB: support "best price search" #291
Comments
@TheRealMurmel FYI: Implementing the "best price search" feature here in |
@derhuerst I would really like to provide more help, but I'm note quite sure when I will have time to contribute here. |
@derhuerst I built a small Python-based project to replay the relevant API requests, this might help someone else to re-implement the requests into hafas-client: |
BTW, if you're more comfortable tinkering with Python instead of JS, adding support for "best price search" to pyhafas would also be an option! We can then port the code over to hafas-client. |
I'll give it a try! |
@bergmannjg has built an "MVP" implementation of this. |
It's nothing more than replacing
with
in the corresponding HAFAS request. It works. |
@derhuerst said
I would propose to add an new method to the hafas-client API because the bestprice search options are only a subset of the journey search options and the results are different. Here is my (not yet complete) implementation
|
Is this planned to be merged? / worked on?
|
I am running this for a few days already without problems, just added the date as a parameter. |
remotely related: #331 |
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 juliuste/db-prices#33 (comment) . It's response data looks like the one of aTripSearch
call, but it also has a fieldres.outDaySegL
that groups the journeys inres.outConL[]
into time brackets.Not sure how this functionality should be exposed:
journeys()
always parse & expose a grouping/bracketing of journeys as soon as the HAFAS response contains it. A DB-specificopt.bestPriceSearch
option would useBestPriceSearch
andoutTime: "000000"
.hafas-client
method. It would have to share much of the logic withjourneys()
. Currently, we don't have a mechanism to let profiles add methods though.pyhafas equivalent Issue: FahrplanDatenGarten/pyhafas#26
The text was updated successfully, but these errors were encountered: