juliuste / lvb

Inofficial LVB (Leipziger Verkehrsbetriebe) API client.
ISC License
31 stars 7 forks source link

LVB API no longer uses IDs #31

Open hashworks opened 3 years ago

hashworks commented 3 years ago

Looks like the LVB API no longer provides station IDs in the AJAX response:

$ curl https://www.l.de/ajax_de?mode=autocomplete&q=Herman&poi=&limit=10
{"stations":[{"name":"Leipzig, Hermann-Liebmann-Str.\/ Eisenbahnstr.","lat":"51.345578950648","lng":"12.406472923894","distance":"2.272732820253887"},{"name":"Leipzig, Dr.-Hermann-Duncker-Str.","lat":"51.333249688312","lng":"12.305794850988","distance":"4.849646498628953"}]}

/fahrplan/abfahrten now uses the whole name instead: request

The lvb.departures test is wrong at that point: Providing the ID results in the departures of a different station.

hashworks commented 3 years ago

So basically, const d = await departures("Leipzig, Hermann-Liebmann-Str./+Eisenbahnstr.", Date.now()) is the way to do things now. Looks like "stations" should only return the "proper" names.

juliuste commented 3 years ago

The package originally included a workaround for that by making departure requests for every station by their name to obtain the ids. This workaround was still in the code, but failing silently. I fixed it now, even though it's ugly, of course, since it requires additional requests. We should probably remove the IDs and switch to names completely.

joergreichert commented 2 years ago

It seems, they complete removed the API, at least the https://www.l.de/verkehrsbetriebe/fahrplan/ doesn't use the form data call anymore, I only see some reiseauskunft.insa.de and some hafas-client library code calls.