public-transport / hafas-client

JavaScript client for HAFAS public transport APIs.
ISC License
268 stars 54 forks source link

get all trips with a line or train number #252

Closed julianx03 closed 2 years ago

julianx03 commented 2 years ago

I have a question about fetching data with client.line

Is it possible to only enter the train number (for example 4803 or so) and get the train directions and times back in an array. Im using right now the oebb profile with the hafas client and i get nothing back, when i enter a train number or something else.

derhuerst commented 2 years ago

I have a question about fetching data with client.line

I assume you mean client.lines()?

Is it possible to only enter the train number (for example 4803 or so) and get the train directions and times back in an array.

In hafas-client's naming scheme, this would be an array of trips. A trip represents the progression of a single vehicle, visiting a set of stops at specific times. Hence, what you'd want to use is client.tripsByName().

Im using right now the oebb profile with the hafas client and i get nothing back, when i enter a train number or something else.

I haven't checked if client.tripsByName() works with the ÖBB endpoint as well, and I haven't checked if it accepts "train numbers" (note that this term has very different meanings depending on the company; even the term "line" isn't used consistently). But we can try:

cd hafas-client
./tools/debug-cli/cli.js oebb tripsByName '4803' | jq '.[] | [.line, .origin.name, .destination.name]'
# Error: Nothing found.
#     at Object.request (/Users/j/web/hafas-client/lib/request.js:109:14)
#     at tripsByName (/Users/j/web/hafas-client/index.js:575:18)
#     at Object.<anonymous> (/Users/j/web/hafas-client/tools/debug-cli/cli.js:67:1)
#     at Module._compile (node:internal/modules/cjs/loader:1095:14)
#     at Object.Module._extensions..js (node:internal/modules/cjs/loader:1147:10)
#     at Module.load (node:internal/modules/cjs/loader:975:32)
#     at Function.Module._load (node:internal/modules/cjs/loader:822:12)
#     at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
#     at node:internal/main/run_main_module:17:47 {
#   isHafasError: true,
#   request: '{"lang":"de","svcReqL":[{"cfg":{"polyEnc":"GPA"},"meth":"JourneyMatch","req":{"input":"4803","onlyCR":true,"jnyFltrL":[{"type":"PROD","mode":"INC","value":"7167"}]}}],"client":{"type":"IPH","id":"OEBB","v":"6030600","name":"oebbPROD-ADHOC"},"ver":"1.41","auth":{"type":"AID","aid":"OWDL4fE4ixNiPBBm"}}',
#   url: 'https://fahrplan.oebb.at/bin/mgate.exe?',
#   statusCode: 200,
#   code: 'NO_MATCH',
#   responseId: 'z2murkc8m6we8g8g'
# }
./tools/debug-cli/cli.js oebb tripsByName '4803' '{onlyCurrentlyRunning: false}' | jq '.[] | [.line, .origin.name, .destination.name]'
[
  {
    "type": "line",
    "id": "bus-4803",
    "fahrtNr": "4803",
    "name": "Bus 4803",
    "public": true,
    "adminCode": "82____",
    "productName": "Bus",
    "mode": "train",
    "product": "national",
    "operator": {
      "type": "operator",
      "id": "cfl",
      "name": "CFL"
    }
  },
  "Luxembourg",
  "Esch-sur-Alzette, Goar"
]
[
  {
    "type": "line",
    "id": "sev",
    "fahrtNr": "4803",
    "name": "Bus SEV",
    "public": true,
    "adminCode": "B2____",
    "productName": "Bus",
    "mode": "train",
    "product": "national",
    "operator": {
      "type": "operator",
      "id": "db-regio-ag-nrw",
      "name": "DB Regio AG NRW"
    }
  },
  "Dortmund Hbf",
  "Iserlohn"
]
[
  {
    "type": "line",
    "id": "sv110",
    "fahrtNr": "4803",
    "name": "BusSV110",
    "public": true,
    "adminCode": "19POWH",
    "productName": "Bus",
    "mode": "train",
    "product": "national",
    "operator": {
      "type": "operator",
      "id": "osterreichische-postbus-aktiengesellschaft",
      "name": "Österreichische Postbus Aktiengesellschaft"
    }
  },
  "Tullnerbach-Pressbaum Bahnhof (Knabstraße)",
  "Neulengbach Stadt Bahnhst (Bahnstraße)"
]
[
  {
    "type": "line",
    "id": "3",
    "fahrtNr": "4803",
    "name": "IRE 3 (Zug-Nr. 4803)",
    "public": true,
    "adminCode": "800693",
    "productName": "IRE",
    "mode": "train",
    "product": "regional",
    "operator": {
      "type": "operator",
      "id": "db-regio-ag-baden-wurttemberg",
      "name": "DB Regio AG Baden-Württemberg"
    }
  },
  "Ulm Hbf",
  "Friedrichshafen Stadt"
]
[
  {
    "type": "line",
    "id": "os-4803-zug-nr-4803",
    "fahrtNr": "4803",
    "name": "Os 4803 (Zug-Nr. 4803)",
    "public": true,
    "adminCode": "56____",
    "productName": "Os",
    "mode": "train",
    "product": "regional",
    "operator": {
      "type": "operator",
      "id": "nahreisezug",
      "name": "Nahreisezug"
    }
  },
  "Nove Zamky",
  "Komarno"
]
[
  {
    "type": "line",
    "id": "os-4803-zug-nr-4803",
    "fahrtNr": "4803",
    "name": "Os 4803 (Zug-Nr. 4803)",
    "public": true,
    "adminCode": "54____",
    "productName": "Os",
    "mode": "train",
    "product": "regional",
    "operator": {
      "type": "operator",
      "id": "nahreisezug",
      "name": "Nahreisezug"
    }
  },
  "Namest nad Oslavou",
  "Brno hl.n."
]
[
  {
    "type": "line",
    "id": "os-4803-zug-nr-4803",
    "fahrtNr": "4803",
    "name": "Os 4803 (Zug-Nr. 4803)",
    "public": true,
    "adminCode": "56____",
    "productName": "Os",
    "mode": "train",
    "product": "regional",
    "operator": {
      "type": "operator",
      "id": "nahreisezug",
      "name": "Nahreisezug"
    }
  },
  "Nove Zamky",
  "Komarno"
]
[
  {
    "type": "line",
    "id": "os-4803-zug-nr-4803",
    "fahrtNr": "4803",
    "name": "Os 4803 (Zug-Nr. 4803)",
    "public": true,
    "adminCode": "54____",
    "productName": "Os",
    "mode": "train",
    "product": "regional",
    "operator": {
      "type": "operator",
      "id": "nahreisezug",
      "name": "Nahreisezug"
    }
  },
  "Namest nad Oslavou",
  "Brno hl.n."
]
[
  {
    "type": "line",
    "id": "r-4803-zug-nr-4803",
    "fahrtNr": "4803",
    "name": "R 4803 (Zug-Nr. 4803)",
    "public": true,
    "adminCode": "78____",
    "productName": "R",
    "mode": "train",
    "product": "regional",
    "operator": {
      "type": "operator",
      "id": "nahreisezug",
      "name": "Nahreisezug"
    }
  },
  "Permani",
  "Rijeka"
]
[
  {
    "type": "line",
    "id": "r-4803-zug-nr-4803",
    "fahrtNr": "4803",
    "name": "R 4803 (Zug-Nr. 4803)",
    "public": true,
    "adminCode": "83____",
    "productName": "R",
    "mode": "train",
    "product": "regional",
    "operator": {
      "type": "operator",
      "id": "nahreisezug",
      "name": "Nahreisezug"
    }
  },
  "Iglesias",
  "Villamassargia-Domusnovas"
]
[
  {
    "type": "line",
    "id": "r-4803-zug-nr-4803",
    "fahrtNr": "4803",
    "name": "R 4803 (Zug-Nr. 4803)",
    "public": true,
    "adminCode": "83____",
    "productName": "R",
    "mode": "train",
    "product": "regional",
    "operator": {
      "type": "operator",
      "id": "nahreisezug",
      "name": "Nahreisezug"
    }
  },
  "Iglesias",
  "Villamassargia-Domusnovas"
]
[
  {
    "type": "line",
    "id": "4",
    "fahrtNr": "4803",
    "name": "S 4 (Zug-Nr. 4803)",
    "public": true,
    "adminCode": "81____",
    "productName": "S",
    "mode": "train",
    "product": "suburban",
    "operator": {
      "type": "operator",
      "id": "nahreisezug",
      "name": "Nahreisezug"
    }
  },
  "Villach Hbf",
  "Hermagor Bahnhof"
]
[
  {
    "type": "line",
    "id": "4",
    "fahrtNr": "4803",
    "name": "S 4 (Zug-Nr. 4803)",
    "public": true,
    "adminCode": "81____",
    "productName": "S",
    "mode": "train",
    "product": "suburban",
    "operator": {
      "type": "operator",
      "id": "nahreisezug",
      "name": "Nahreisezug"
    }
  },
  "Villach Hbf",
  "Hermagor Bahnhof"
]
[
  {
    "type": "line",
    "id": "4",
    "fahrtNr": "4803",
    "name": "S 4 (Zug-Nr. 4803)",
    "public": true,
    "adminCode": "81____",
    "productName": "S",
    "mode": "train",
    "product": "suburban",
    "operator": {
      "type": "operator",
      "id": "nahreisezug",
      "name": "Nahreisezug"
    }
  },
  "Villach Hbf",
  "Arnoldstein Bahnhof"
]
[
  {
    "type": "line",
    "id": "127",
    "fahrtNr": "4803",
    "name": "Bus 127",
    "public": true,
    "adminCode": "850807",
    "productName": "Bus",
    "mode": "bus",
    "product": "bus",
    "operator": {
      "type": "operator",
      "id": "sihltal-zurich-uetliberg-bahn",
      "name": "Sihltal-Zürich-Uetliberg-Bahn"
    }
  },
  "Wädenswil, Bahnhof",
  "Wädenswil, Bahnhof"
]
[
  {
    "type": "line",
    "id": "136",
    "fahrtNr": "4803",
    "name": "Bus 136",
    "public": true,
    "adminCode": "850807",
    "productName": "Bus",
    "mode": "bus",
    "product": "bus",
    "operator": {
      "type": "operator",
      "id": "sihltal-zurich-uetliberg-bahn",
      "name": "Sihltal-Zürich-Uetliberg-Bahn"
    }
  },
  "Oberrieden(CH), Bahnhof",
  "Horgen, Bahnhof"
]
[
  {
    "type": "line",
    "id": "28",
    "fahrtNr": "4803",
    "name": "Bus 28",
    "public": true,
    "adminCode": "S40000",
    "productName": "Bus",
    "mode": "bus",
    "product": "bus",
    "operator": {
      "type": "operator",
      "id": "albus-salzburg-verkehrsbetrieb-gmbh",
      "name": "Albus Salzburg Verkehrsbetrieb GmbH"
    }
  },
  "Salzburg Taxham Europark S-Bahn (Europastraße)",
  "Salzburg Ferdinand-Hanusch-Platz (Franz-Josef-Kai)"
]
[
  {
    "type": "line",
    "id": "320",
    "fahrtNr": "4803",
    "name": "Bus 320",
    "public": true,
    "adminCode": "v26DrN",
    "productName": "Bus",
    "mode": "bus",
    "product": "bus",
    "operator": {
      "type": "operator",
      "id": "dr-richard-niederosterreich-verkehrsbetrieb-gmbh-co-kg",
      "name": "Dr.Richard Niederösterreich Verkehrsbetrieb GmbH & Co KG"
    }
  },
  "Unterwaltersdorf Hauptplatz",
  "Baden b.Wien Josefsplatz (Kaiser-F.-Joseph-Ring)"
]
[
  {
    "type": "line",
    "id": "33",
    "fahrtNr": "4803",
    "name": "Bus 33",
    "public": true,
    "adminCode": "s3800_",
    "productName": "Bus",
    "mode": "bus",
    "product": "bus",
    "operator": {
      "type": "operator",
      "id": "holding-graz-linien",
      "name": "Holding Graz Linien"
    }
  },
  "Graz Jakominiplatz (Mitte)",
  "Graz Peter-Rosegger-Straße"
]
[
  {
    "type": "line",
    "id": "504",
    "fahrtNr": "4803",
    "name": "Bus 504",
    "public": true,
    "adminCode": "850801",
    "productName": "Bus",
    "mode": "bus",
    "product": "bus",
    "operator": {
      "type": "operator",
      "id": "postauto-schweiz",
      "name": "PostAuto Schweiz"
    }
  },
  "Oberglatt ZH, Bahnhof",
  "Bülach, Bahnhof"
]
[
  {
    "type": "line",
    "id": "53",
    "fahrtNr": "4803",
    "name": "Bus 53",
    "public": true,
    "adminCode": "s3800_",
    "productName": "Bus",
    "mode": "bus",
    "product": "bus",
    "operator": {
      "type": "operator",
      "id": "holding-graz-linien",
      "name": "Holding Graz Linien"
    }
  },
  "Stattegg Fuß der Leber",
  "Graz Hbf (Europaplatz)"
]
[
  {
    "type": "line",
    "id": "663",
    "fahrtNr": "4803",
    "name": "Bus 663",
    "public": true,
    "adminCode": "o01PO_",
    "productName": "Bus",
    "mode": "bus",
    "product": "bus",
    "operator": {
      "type": "operator",
      "id": "osterreichische-postbus-aktiengesellschaft",
      "name": "Österreichische Postbus Aktiengesellschaft"
    }
  },
  "Eferding Busterminal (Schulzentrum)",
  "Dachsberg OÖ Gymnasium (Landesstraße)"
]
[
  {
    "type": "line",
    "id": "680",
    "fahrtNr": "4803",
    "name": "Bus 680",
    "public": true,
    "adminCode": "v12Pos",
    "productName": "Bus",
    "mode": "bus",
    "product": "bus",
    "operator": {
      "type": "operator",
      "id": "osterreichische-postbus-aktiengesellschaft",
      "name": "Österreichische Postbus Aktiengesellschaft"
    }
  },
  "Ruprechtshofen NÖ Hauptplatz",
  "Ober-Grafendorf Bahnhof (Bahnhofplatz)"
]
[
  {
    "type": "line",
    "id": "732",
    "fahrtNr": "4803",
    "name": "Bus 732",
    "public": true,
    "adminCode": "v12Pos",
    "productName": "Bus",
    "mode": "bus",
    "product": "bus",
    "operator": {
      "type": "operator",
      "id": "osterreichische-postbus-aktiengesellschaft",
      "name": "Österreichische Postbus Aktiengesellschaft"
    }
  },
  "Zwettl NÖ Busbahnhof (Gerungser Straße)",
  "Grafenschlag b.Zwettl Ort"
]
[
  {
    "type": "line",
    "id": "732",
    "fahrtNr": "4803",
    "name": "Bus 732",
    "public": true,
    "adminCode": "v12Pos",
    "productName": "Bus",
    "mode": "bus",
    "product": "bus",
    "operator": {
      "type": "operator",
      "id": "osterreichische-postbus-aktiengesellschaft",
      "name": "Österreichische Postbus Aktiengesellschaft"
    }
  },
  "Zwettl NÖ Busbahnhof (Gerungser Straße)",
  "Grafenschlag b.Zwettl Ort"
]
[
  {
    "type": "line",
    "id": "742",
    "fahrtNr": "4803",
    "name": "Bus 742",
    "public": true,
    "adminCode": "850773",
    "productName": "Bus",
    "mode": "bus",
    "product": "bus",
    "operator": {
      "type": "operator",
      "id": "verkehrsbetriebe-glattal",
      "name": "Verkehrsbetriebe Glattal"
    }
  },
  "Rümlang, Bahnhof",
  "Zürich, Seebach Tramschleife"
]
[
  {
    "type": "line",
    "id": "754",
    "fahrtNr": "4803",
    "name": "Bus 754",
    "public": true,
    "adminCode": "850773",
    "productName": "Bus",
    "mode": "bus",
    "product": "bus",
    "operator": {
      "type": "operator",
      "id": "verkehrsbetriebe-glattal",
      "name": "Verkehrsbetriebe Glattal"
    }
  },
  "Dübendorf, Bahnhof",
  "Stettbach, Bahnhof"
]
[
  {
    "type": "line",
    "id": "81",
    "fahrtNr": "4803",
    "name": "Bus 81",
    "public": true,
    "adminCode": "k0100_",
    "productName": "Bus",
    "mode": "bus",
    "product": "bus",
    "operator": {
      "type": "operator",
      "id": "kmg-klagenfurt-mobil-gmbh",
      "name": "KMG | Klagenfurt Mobil GmbH"
    }
  },
  "Klagenfurt Viktring Krottendorf",
  "Klagenfurt Hbf (Busbahnhof)"
]
[
  {
    "type": "line",
    "id": "85",
    "fahrtNr": "4803",
    "name": "Bus 85",
    "public": true,
    "adminCode": "k0100_",
    "productName": "Bus",
    "mode": "bus",
    "product": "bus",
    "operator": {
      "type": "operator",
      "id": "kmg-klagenfurt-mobil-gmbh",
      "name": "KMG | Klagenfurt Mobil GmbH"
    }
  },
  "Klagenfurt Ganghofergasse",
  "Klagenfurt Heiligengeistplatz (Wiesbadener Straße)"
]
[
  {
    "type": "line",
    "id": "r",
    "fahrtNr": "4803",
    "name": "Bus R",
    "public": true,
    "adminCode": "t1900_",
    "productName": "Bus",
    "mode": "bus",
    "product": "bus",
    "operator": {
      "type": "operator",
      "id": "innsbrucker-verkehrsbetriebe-und-stubaitalbahn-gmbh",
      "name": "Innsbrucker Verkehrsbetriebe und Stubaitalbahn GmbH"
    }
  },
  "Innsbruck Rehgasse",
  "Innsbruck DEZ (Ikea)"
]
[
  {
    "type": "line",
    "id": "mkk81",
    "fahrtNr": "4803",
    "name": "BusMKK81",
    "public": true,
    "adminCode": "rmv293",
    "productName": "Bus",
    "mode": "bus",
    "product": "bus",
    "operator": {
      "type": "operator",
      "id": "nahreisezug",
      "name": "Nahreisezug"
    }
  },
  "Busbahnhof, Bad Orb",
  "Busbahnhof, Wächtersbach"
]
[
  {
    "type": "line",
    "id": "5",
    "fahrtNr": "4803",
    "name": "O-Bus 5",
    "public": true,
    "adminCode": "S10000",
    "productName": "O-Bus",
    "mode": "bus",
    "product": "bus",
    "operator": {
      "type": "operator",
      "id": "salzburg-ag-o-bus",
      "name": "Salzburg AG - O-Bus"
    }
  },
  "Salzburg Rathaus",
  "Grödig Untersbergbahn (Busterminal)"
]
[
  {
    "type": "line",
    "id": "8",
    "fahrtNr": "4803",
    "name": "O-Bus 8",
    "public": true,
    "adminCode": "S10000",
    "productName": "O-Bus",
    "mode": "bus",
    "product": "bus",
    "operator": {
      "type": "operator",
      "id": "salzburg-ag-o-bus",
      "name": "Salzburg AG - O-Bus"
    }
  },
  "Salzburg Süd S-Bahn (Wendestelle)",
  "Salzburg Salzburgarena"
]
[
  {
    "type": "line",
    "id": "u2",
    "fahrtNr": "4803",
    "name": "U2",
    "public": true,
    "adminCode": "v04WL_",
    "mode": "train",
    "product": "subway",
    "operator": {
      "type": "operator",
      "id": "wiener-linien-gmbh-co-kg",
      "name": "Wiener Linien GmbH & Co KG"
    }
  },
  "Wien Seestadt (U2)",
  "Wien Schottentor (U2)"
]
[
  {
    "type": "line",
    "id": "u2",
    "fahrtNr": "4803",
    "name": "U2",
    "public": true,
    "adminCode": "v04WL_",
    "mode": "train",
    "product": "subway",
    "operator": {
      "type": "operator",
      "id": "wiener-linien-gmbh-co-kg",
      "name": "Wiener Linien GmbH & Co KG"
    }
  },
  "Wien Seestadt (U2)",
  "Wien Schottentor (U2)"
]
[
  {
    "type": "line",
    "id": "3",
    "fahrtNr": "4803",
    "name": "Tram 3",
    "public": true,
    "adminCode": "e01LL_",
    "productName": "Tram",
    "mode": "train",
    "product": "tram",
    "operator": {
      "type": "operator",
      "id": "linz-linien-ag",
      "name": "Linz Linien AG"
    }
  },
  "Leonding Im Bäckerfeld (Straßenbahn)",
  "Traun OÖ Trauner Kreuzung (Kremstalstraße)"
]
[
  {
    "type": "line",
    "id": "4",
    "fahrtNr": "4803",
    "name": "Tram 4",
    "public": true,
    "adminCode": "e01LL_",
    "productName": "Tram",
    "mode": "train",
    "product": "tram",
    "operator": {
      "type": "operator",
      "id": "linz-linien-ag",
      "name": "Linz Linien AG"
    }
  },
  "Traun OÖ Schloss",
  "Linz/Donau Landgutstraße"
]
[
  {
    "type": "line",
    "id": "4",
    "fahrtNr": "4803",
    "name": "Tram 4",
    "public": true,
    "adminCode": "s3300_",
    "productName": "Tram",
    "mode": "train",
    "product": "tram",
    "operator": {
      "type": "operator",
      "id": "holding-graz-linien",
      "name": "Holding Graz Linien"
    }
  },
  "Graz Liebenau Murpark (Straßenbahn)",
  "Graz Laudongasse"
]
[
  {
    "type": "line",
    "id": "mbe",
    "fahrtNr": "4803",
    "name": "Seilbahn",
    "public": true,
    "adminCode": "s96MB_",
    "productName": "Seilbahn",
    "mode": null,
    "product": "onCall",
    "operator": {
      "type": "operator",
      "id": "nahreisezug",
      "name": "Nahreisezug"
    }
  },
  "Mariazell Seilbahn Talstation",
  "Mariazell Bürgeralpe Bergstation (Seilbahn)"
]
derhuerst commented 2 years ago

Does that answer your questions?

julianx03 commented 2 years ago

A little bit. I want to build a passenger information system (FIS), where i can display the trains stops and the arrival times. I want to load the timetable for the train and display it. Now i also found out that i have to enter de id (for example s-4-zug-nr-4830) because when i only input the train number, it shows me to many trains. Is it possible to enter the id?

Edit: i can't use client.liens(), because i not know, what i should take as option for it. I tried everything, nothing works. No train number, id or name.

derhuerst commented 2 years ago

I want to [...] display the trains stops and the arrival times. I want to load the timetable for the train and display it.

Let's do it the other way around: Which trains do you want to show the timetable/schedule for? Please elaborate which trains you're talking about. All long-distance trains? All trains? All trains of a certain line? All trains in a certain direction?

julianx03 commented 2 years ago

All trains for a certain line. I want for example the Train S4 to Hermagor with the number 4801. I want for this train the timetable.

julianx03 commented 2 years ago

i want to build something like this ÖBB-Railjet_Fahrgastinformation_(2016)

derhuerst commented 2 years ago

All trains for a certain line. I want for example the Train S4 to Hermagor with the number 4801. I want for this train the timetable.

The timetable for any S4 trip? Or all trips?

You can obtain all trips using client.tripsByName('S4801', {onlyCurrentlyRunning: false}):

[
    {
        "origin": {
            "type": "stop",
            "id": "8100147",
            "name": "Villach Hbf",
            "location": {
                "type": "location",
                "id": "8100147",
                "latitude": 46.618697,
                "longitude": 13.848817
            },
            "products": {
                "nationalExpress": true,
                "national": true,
                "interregional": true,
                "regional": true,
                "suburban": true,
                "bus": false,
                "ferry": false,
                "subway": false,
                "tram": false,
                "onCall": false
            }
        },
        "destination": {
            "type": "stop",
            "id": "8100270",
            "name": "Hermagor Bahnhof",
            "location": {
                "type": "location",
                "id": "8100270",
                "latitude": 46.626364,
                "longitude": 13.37567
            },
            "products": {
                "nationalExpress": false,
                "national": false,
                "interregional": false,
                "regional": true,
                "suburban": true,
                "bus": false,
                "ferry": false,
                "subway": false,
                "tram": false,
                "onCall": false
            }
        },
        "departure": "2021-09-24T05:18:00+02:00",
        "plannedDeparture": "2021-09-24T05:18:00+02:00",
        "departureDelay": null,
        "arrival": "2021-09-24T06:18:00+02:00",
        "plannedArrival": "2021-09-24T06:18:00+02:00",
        "arrivalDelay": null,
        "line": {
            "type": "line",
            "id": "4",
            "fahrtNr": "4801",
            "name": "S 4 (Zug-Nr. 4801)",
            "public": true,
            "adminCode": "81____",
            "productName": "S",
            "mode": "train",
            "product": "suburban",
            "operator": {
                "type": "operator",
                "id": "nahreisezug",
                "name": "Nahreisezug"
            }
        },
        "direction": null,
        "currentLocation": {
            "type": "location",
            "latitude": 46.626499,
            "longitude": 13.375742
        },
        "arrivalPlatform": null,
        "plannedArrivalPlatform": null,
        "departurePlatform": null,
        "plannedDeparturePlatform": null,
        "id": "2|#VN#1#ST#1637842142#PI#0#ZI#289129#TA#0#DA#240921#1S#8100147#1T#518#LS#8100270#LT#618#PU#81#RT#1#CA#s#ZE#4#ZB#S 4     #PC#5#FR#8100147#FT#518#TO#8100270#TT#618#",
        "realtimeDataUpdatedAt": 1638388046
    },
    {
        "origin": {
            "type": "stop",
            "id": "8100147",
            "name": "Villach Hbf",
            "location": {
                "type": "location",
                "id": "8100147",
                "latitude": 46.618697,
                "longitude": 13.848817
            },
            "products": {
                "nationalExpress": true,
                "national": true,
                "interregional": true,
                "regional": true,
                "suburban": true,
                "bus": false,
                "ferry": false,
                "subway": false,
                "tram": false,
                "onCall": false
            }
        },
        "destination": {
            "type": "stop",
            "id": "8100270",
            "name": "Hermagor Bahnhof",
            "location": {
                "type": "location",
                "id": "8100270",
                "latitude": 46.626364,
                "longitude": 13.37567
            },
            "products": {
                "nationalExpress": false,
                "national": false,
                "interregional": false,
                "regional": true,
                "suburban": true,
                "bus": false,
                "ferry": false,
                "subway": false,
                "tram": false,
                "onCall": false
            }
        },
        "departure": "2021-12-13T05:18:00+01:00",
        "plannedDeparture": "2021-12-13T05:18:00+01:00",
        "departureDelay": null,
        "arrival": "2021-12-13T06:18:00+01:00",
        "plannedArrival": "2021-12-13T06:18:00+01:00",
        "arrivalDelay": null,
        "line": {
            "type": "line",
            "id": "4",
            "fahrtNr": "4801",
            "name": "S 4 (Zug-Nr. 4801)",
            "public": true,
            "adminCode": "81____",
            "productName": "S",
            "mode": "train",
            "product": "suburban",
            "operator": {
                "type": "operator",
                "id": "nahreisezug",
                "name": "Nahreisezug"
            }
        },
        "direction": null,
        "currentLocation": {
            "type": "location",
            "latitude": 46.626499,
            "longitude": 13.375742
        },
        "arrivalPlatform": null,
        "plannedArrivalPlatform": null,
        "departurePlatform": null,
        "plannedDeparturePlatform": null,
        "id": "2|#VN#1#ST#1637842997#PI#3#ZI#230261#TA#0#DA#131221#1S#8100147#1T#518#LS#8100270#LT#618#PU#181#RT#1#CA#s#ZE#4#ZB#S 4     #PC#5#FR#8100147#FT#518#TO#8100270#TT#618#",
        "realtimeDataUpdatedAt": 1638388046
    },
    {
        "origin": {
            "type": "stop",
            "id": "8100147",
            "name": "Villach Hbf",
            "location": {
                "type": "location",
                "id": "8100147",
                "latitude": 46.618697,
                "longitude": 13.848817
            },
            "products": {
                "nationalExpress": true,
                "national": true,
                "interregional": true,
                "regional": true,
                "suburban": true,
                "bus": false,
                "ferry": false,
                "subway": false,
                "tram": false,
                "onCall": false
            }
        },
        "destination": {
            "type": "stop",
            "id": "8100056",
            "name": "Arnoldstein Bahnhof",
            "location": {
                "type": "location",
                "id": "8100056",
                "latitude": 46.551484,
                "longitude": 13.707795
            },
            "products": {
                "nationalExpress": false,
                "national": false,
                "interregional": false,
                "regional": true,
                "suburban": true,
                "bus": false,
                "ferry": false,
                "subway": false,
                "tram": false,
                "onCall": false
            }
        },
        "departure": "2021-09-24T05:18:00+02:00",
        "plannedDeparture": "2021-09-24T05:18:00+02:00",
        "departureDelay": null,
        "arrival": "2021-09-24T05:40:00+02:00",
        "plannedArrival": "2021-09-24T05:40:00+02:00",
        "arrivalDelay": null,
        "line": {
            "type": "line",
            "id": "4",
            "fahrtNr": "4801",
            "name": "S 4 (Zug-Nr. 4801)",
            "public": true,
            "adminCode": "81____",
            "productName": "S",
            "mode": "train",
            "product": "suburban",
            "operator": {
                "type": "operator",
                "id": "nahreisezug",
                "name": "Nahreisezug"
            }
        },
        "direction": null,
        "currentLocation": {
            "type": "location",
            "latitude": 46.626499,
            "longitude": 13.375742
        },
        "arrivalPlatform": null,
        "plannedArrivalPlatform": null,
        "departurePlatform": null,
        "plannedDeparturePlatform": null,
        "id": "2|#VN#1#ST#1637842142#PI#0#ZI#289129#TA#0#DA#240921#1S#8100147#1T#518#LS#8100270#LT#618#PU#81#RT#1#CA#s#ZE#4#ZB#S 4     #PC#5#FR#8100147#FT#518#TO#8100270#TT#618#",
        "realtimeDataUpdatedAt": 1638388046
    }
]

These results are equivalent to those from this page: https://fahrplan.oebb.at/bin/trainsearch.exe/dn?&trainname=S%204801&stationFilter=81&selectDate=period

julianx03 commented 2 years ago

Thanks! I also want the stations, where the train stops

derhuerst commented 2 years ago

Thanks! I also want the stations, where the train stops

You'll have to use client.trip(tripId, {stopovers: true}) for each result, then each trip will have a stopovers[] array.

julianx03 commented 2 years ago

Thanks for responding. Now with this informartuin, i can get with client.tripByName() the train with the information, and than pass them to client.trip(), to get stops of the train with time.

Thank you ;)

derhuerst commented 2 years ago

You're welcome!

Please re-open if you have further related questions, and create another Issue if you have an unrelated question.