Giter Site home page Giter Site logo

get all stations from the API about lvb HOT 3 OPEN

juliuste avatar juliuste commented on August 21, 2024
get all stations from the API

from lvb.

Comments (3)

hashworks avatar hashworks commented on August 21, 2024 2

You can use the autocomplete API to get a list of all stations:
$ curl "https://www.l.de/ajax_de?mode=autocomplete&q=&poi=&limit=2" | jq

{
  "stations": [
    {
      "name": "Leipzig, Markt",
      "lat": "51.339882282118",
      "lng": "12.374237209778",
      "distance": "0.078350872860768"
    },
    {
      "name": "Leipzig, Reichsstraße",
      "lat": "51.341836324787",
      "lng": "12.376662567095",
      "distance": "0.19867293290099325"
    }
  ]
}

You can set the limit as high as you like!

$ curl "https://www.l.de/ajax_de?mode=autocomplete&q=&poi=&limit=1000" | jq | grep name | wc -l`
877

So, this endpoint returns up to 877 stations. A word of warning: Don't call this too often, or they might add a hard limit. Cache it, updating it every few weeks should be quite enough.

As you see this will only provide you with the station names, so after you select one you still have to call the stations API to acquire the ID.

Maybe I'll have time to implement this later, but we really need to cache it.

from lvb.

juliuste avatar juliuste commented on August 21, 2024

Sorry for the very late response. Unfortunately, there is no such endpoint available, as fas as I know. Maybe @hashworks knows more?

from lvb.

Rennbahn2000 avatar Rennbahn2000 commented on August 21, 2024

Liste der Haltestelle
haltestellen.txt
n

from lvb.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.