juliuste / api.direkt.bahn.guru

Backend for direkt.bahn.guru
https://api.direkt.bahn.guru
ISC License
56 stars 7 forks source link

The ?origin= feature does't show train connections for a couple of (usually smaller) German cities #3

Open tifa365 opened 2 years ago

tifa365 commented 2 years ago

Some examplery cities that do not work are Goch and Kleve.

Error: "Leider konnten für die Stadt, die du gesucht hast, keine Verbindungen gefunden werden."

bxt commented 2 years ago

I think that's the wrong repository, maybe you can open the issue here: https://github.com/juliuste/direkt.bahn.guru/issues (or maybe it's a problem in the backend even? https://github.com/juliuste/api.direkt.bahn.guru/issues)

I found also some smaller stations have some connections, but not all of them. E.g from Bergedorf https://direkt.bahn.guru/?origin=8002554 you can also go to Hamburg Hbf if you take RE1 in the other direction, but it's not marked on the map and not in the API response of https://api.direkt.bahn.guru/8002554?allowLocalTrains=true for some reason.

Maybe it's also a good idea to link to the Reddit thread, there are some more examples: https://www.reddit.com/r/de/comments/qg0fvy/wenn_ich_im_n%C3%A4chsten_bahnhof_einsteige_wohin/hi33dds/

I wrote a small script to retreive the data using db-hafas directly in a way similar to the reachableForDay function, and I got "Error: opt.stopovers is not supported by this endpoint", so I wonder how the API gets this data, and I can not debug further, I guess. When I do not ask for the stopovers, I get a lot of departures. E.g. from 8002296, there's trains to Geldern and Kleve. And for 8002554 there's some departures with direction: 'Hamburg Hbf', as well.

Here's the script I used ``` import createHafas from 'db-hafas' const hafas = createHafas('test'); const allowLocalTrains = true; const date = new Date(); const departures = await hafas.departures('8002554', { when: date, duration: 24 * 60, // 24h products: { nationalExpress: true, national: true, regionalExp: allowLocalTrains, regional: allowLocalTrains, suburban: false, bus: false, ferry: false, subway: false, tram: false, taxi: false, }, // stopovers: true, remarks: false, }) console.log({departures}); ```
derhuerst commented 2 years ago

I think that's the wrong repository, maybe you can open the issue here: https://github.com/juliuste/direkt.bahn.guru/issues (or maybe it's a problem in the backend even? https://github.com/juliuste/api.direkt.bahn.guru/issues)

Yes, the backend repo api.direkt.bahn.guru is a better place to report this issue. The actual issue is probably beneath even.

derhuerst commented 2 years ago

I wrote a small script to retreive the data using db-hafas directly in a way similar to the reachableForDay function, and I got "Error: opt.stopovers is not supported by this endpoint", so I wonder how the API gets this data, and I can not debug further, I guess.

This is because newer "protocol versions" of the DB HAFAS API (and also other HAFAS APIs) don't support it anymore, and thus newer versions of db-hafas (or the underlying library hafas-client, to be exact) don't support it either; api.direkt.bahn.guru uses an old version of db-hafas and thus an old version of hafas-client.

I assume the company developing HAFAS wants to remove it permanently, so they wait until most old clients stop requesting.