-
-
Notifications
You must be signed in to change notification settings - Fork 54
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: get URL to offers #296
Comments
I have looked into how the DB Navigator app does this. We can probably mimic its functionality! Given that Note: Keep in mind that there's also a (currently half-broken, because the DB shop changes frequently) library that, given a full journey – obtained from |
I have recorded the HTTP requests of DB Navigator For For example, with the requested journey from Berlin to Wien at {
"AngTyp": "superSparP",
"IsKBKampagne": "NO",
"ID": "TCK#3860#3863#0#0#S2#9810#",
"IDVerbund": "PFRhcmlmZiBUYXJpZmZJRD0iVENLIzM4NjAjMzg2MyMwIzAjUzIjOTgxMCMiIFBBcnREcml0dGU9InVua25vd24iLz4%3D%0D%0A",
"IsVisible": "YES",
"KoTxt_kurz.0": "",
"KoTxt_lang.0": "Through ticket: Your ticket constitutes a continuous contract of carriage in each direction. Should you make a passenger rights claim, the ticket will be considered in its entirety.",
"KoTxt_kurz.1": "",
"KoTxt_lang.1": "A 3-D Secure Code may be required for credit card payments.",
"PrioTxt_kurz.0": "Train-specific travel",
"PrioTxt_lang.0": "You can use all trains indicated on your ticket. You can use any local train (i.e. RE, RB, S). Passengers on train services with mandatory reservation must reserve a seat.",
"PrioTxt_icon.0": "202",
"PrioTxt_kurz.1": "",
"PrioTxt_lang.1": "If you choose a train service that requires a reservation, your booking includes a free seat reservation for this train service.",
"UeTxt_kurz": "Cancellation excluded",
"UeTxt_lang": "Cancellation (exchange or refund) of your ticket is excluded.",
"UeTxt_icon": "202",
"OptTxt_kurz.0": "No City-Ticket",
"OptTxt_lang.0": "Your ticket does not include a City-Ticket (local public transport ticket).",
"OptTxt_icon.0": "202",
"OptTxt_key.0": "ohne_city",
"PATyp": "AP",
"PArtDpt": "3860",
"ResIcon": "NO",
"ResStatus": "O",
"TarifSystemId": "DB",
"ZugeordnetZuSpezialablauf": "NO",
"Zusatznutzen": "NO"
} It's {
"dir": "OUTWARD",
"type": "TICKET",
"FromText": "Berlin Hbf (tief)",
"ToText": "Wien Hbf",
"FromEva": "8098160",
"ToEva": "8103000"
} The fare's
|
What needs to be done:
|
A heads-up: Implementing this feature will require some familiarity with the way the |
Thank you very much for the input! Super nice of you! |
Short update:
This:
resulted in:
unfortunately there is just a buttonText and no buttonUrl :D |
Can you elaborate? Or even provide two raw responses? (You can obtain them by running |
Thanks for pointing out the DEBUG mode :) It seems like the 'fareSetL[]' differ when using TripSearch or Reconstruction (e.g. only Reconstruction containing I added the used commands at the top of each file in case I am using them wrong. |
Did you specify |
I had to dig a little deeper but i found the issue now :) The Edit: PR |
After looking deeper into the URL topic I am pretty sure that there will be more changes regarding the output format which is why I closed the PR for now. I will incorporate the changes in a future PR :) |
From #297:
Keep in mind that I try to minimise the breaking changes (and thus major-version releases) in So if it's possible with reasonable effort, try to keep your changes backwards-compatible, by adding all newly parsed information as a new field. Later, we can refactor the format as a breaking change. |
This [edit: permalink] is a non breaking version that enables to get fares and the url to each fare via |
Again: Thanks for you effort in reverse-engineering and implementing this! I think this is a very useful addition to Unfortunately, the commits currently change too many unrelated things for me to feel comfortable to merge them as-is, for example:
If you want, I can try to find time to bring your changes into the shape I want them to be in and merge them. (I will make sure to keep you as the author or co-author in the resulting commits, so that you will appear as a contributor to On the other hand, if you're planning to change the code anyways, in one way or another, I will first let you finish iterating on it, and then review it again. What do you think? |
Sounds great! |
@PaulSut Any news? |
Unfortunately not really :/ |
I created a new PR which adds the ticket information. I am rather pessemistic regarding the URL. The generated URLs 'kind of work'. But not with every device/browser/cookie combination and therefore imo not reliable enough to add it to the hafas client. Even if the link works it is not really user friendly |
We could put them behind an opt-in flag, e.g. |
This and your suggested changes are now implemented :) |
I'd like to create a URL for a specific Journey that takes me directly to the DB offers page, where I can select offers like Sparpreis and Flexpreis for a specific journey. I'm unsure about the best approach for this. Any guidance would be greatly appreciated.
I would also be happy to contribute a function which creates the URL if there is an interest for this :)
The text was updated successfully, but these errors were encountered: