Skip to content
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

Invalid JSON response. Bahn API change? #4

Open
thigg opened this issue Feb 10, 2023 · 2 comments · May be fixed by public-transport/hafas-client#314
Open

Invalid JSON response. Bahn API change? #4

thigg opened this issue Feb 10, 2023 · 2 comments · May be fixed by public-transport/hafas-client#314

Comments

@thigg
Copy link

thigg commented Feb 10, 2023

/usr/bin/node /path/prices.js
✔ From where? › Hamburg-Altona – score: 14.324 relevance: 1.824 stationcode: 8002553
✔ To where? › Berlin Hauptbahnhof – score: 14.284 relevance: 1.730 stationcode: 8011160
FetchError: invalid json response body at https://reiseauskunft.bahn.de/bin/query.exe/dn?tbpMode=1&date=%2B1&getstop=1 reason: Unexpected token '<', "<!DOCTYPE "... is not valid JSON
    at /path/node_modules/node-fetch/lib/index.js:273:32
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async /path/prices.js:62:25
    at async Promise.all (index 1)
    at async /path/prices.js:61:23 {
  type: 'invalid-json'
}

Is it still recommended to use this tool? I use it to regularly fetch prices for connections.

Thanks for this tool. This already helped me to gather very nice data with fahrpreisplotter <3

@thigg thigg changed the title Invalid JSON response. Bahn aPI change? Invalid JSON response. Bahn API change? Feb 10, 2023
@derhuerst derhuerst added the bug label Feb 10, 2023
@derhuerst
Copy link
Owner

It seems that this is because the underlying API has been shut off or modified. Please follow juliuste/db-prices#33 for updates.

@thigg
Copy link
Author

thigg commented Mar 20, 2024

Just FYI: I rewrote my tool using a branch of hafas-client, based on the bestPrices api. https://github.com/thigg/fahrpreis-plotter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants