derhuerst / db-prices-cli

Check prices for a DB route.
https://github.com/derhuerst/db-prices-cli
ISC License
12 stars 1 forks source link

Invalid JSON response. Bahn API change? #4

Open thigg opened 1 year ago

thigg commented 1 year ago
/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

derhuerst commented 1 year ago

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

thigg commented 6 months ago

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