From c00b3f0fabda75e23a986f125d06d0a250752b0f Mon Sep 17 00:00:00 2001 From: "user@node5.net" Date: Sun, 4 May 2025 13:28:22 +0200 Subject: Transit timetable display - Rejseplanen API POC + Rename article Rename article: Train timetable display -> Transit departure display --- Train timetable display/POC.webp | Bin 56858 -> 0 bytes Train timetable display/Thumbnail.webp | Bin 5626 -> 0 bytes Train timetable display/index.md | 7 ---- Transit departure display/POC.webp | Bin 0 -> 56858 bytes Transit departure display/Thumbnail.webp | Bin 0 -> 5626 bytes Transit departure display/index.md | 70 +++++++++++++++++++++++++++++++ 6 files changed, 70 insertions(+), 7 deletions(-) delete mode 100644 Train timetable display/POC.webp delete mode 100644 Train timetable display/Thumbnail.webp delete mode 100644 Train timetable display/index.md create mode 100644 Transit departure display/POC.webp create mode 100644 Transit departure display/Thumbnail.webp create mode 100644 Transit departure display/index.md diff --git a/Train timetable display/POC.webp b/Train timetable display/POC.webp deleted file mode 100644 index 5f1e147..0000000 Binary files a/Train timetable display/POC.webp and /dev/null differ diff --git a/Train timetable display/Thumbnail.webp b/Train timetable display/Thumbnail.webp deleted file mode 100644 index 7ef1b50..0000000 Binary files a/Train timetable display/Thumbnail.webp and /dev/null differ diff --git a/Train timetable display/index.md b/Train timetable display/index.md deleted file mode 100644 index eb32cac..0000000 --- a/Train timetable display/index.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -description: Train departure display -created: 2025-03-30 ---- - -![POC](POC.webp) - diff --git a/Transit departure display/POC.webp b/Transit departure display/POC.webp new file mode 100644 index 0000000..5f1e147 Binary files /dev/null and b/Transit departure display/POC.webp differ diff --git a/Transit departure display/Thumbnail.webp b/Transit departure display/Thumbnail.webp new file mode 100644 index 0000000..7ef1b50 Binary files /dev/null and b/Transit departure display/Thumbnail.webp differ diff --git a/Transit departure display/index.md b/Transit departure display/index.md new file mode 100644 index 0000000..eadd434 --- /dev/null +++ b/Transit departure display/index.md @@ -0,0 +1,70 @@ +--- +description: Public transit time table +created: 2025-03-30 +--- + +![POC](POC.webp) + +## Data POC + +### mittog.dk + +- https://mittog.dk/da/departures/KH/stog +- https://github.com/vi/websocat + +```console +websocat 'wss://api.mittog.dk/api/ws/stog/departure/KH/dinstation/' -B 500000 | jq +``` + +It's easily scrapable, but doesn't provide bus depature times. + +### rejseplanen API + +Journey planner however can be used for both trains and busses + +- You can find the API at: [labs.rejseplanen.dk](https://labs.rejseplanen.dk/) +- [Rejseplanen api departure board endpoint documentation](https://www.rejseplanen.dk/api/departureBoard?wadl) +- The list of stop IDs can be aquired from the [GTFS.zip](https://www.rejseplanen.info/labs/GTFS.zip) file + +```bash +curl 'https://www.rejseplanen.dk/api/departureBoard?accessId=XXX&format=json&id=000008600646' > nørreport_st.json +cat nørreport_st.json | jq '.Departure | .[] | {name: .name, planned_time: .time, direction: .direction, actual_time: .rtTime}' | jq --slurp +``` + +```JSON + { + "name": "Re 1070", + "direction": "Helsingborg C", + "planned_time": "12:53:00", + "actual_time": null + }, + { + "name": "C", + "direction": "Frederikssund St.", + "planned_time": "12:53:00", + "actual_time": null + }, + { + "name": "Metro M2", + "direction": "Vanløse", + "planned_time": "12:54:37", + "actual_time": null + }, + { + "name": "Bus 5C", + "direction": "Sundbyvester Plads", + "planned_time": "12:55:00", + "actual_time": "12:58:00" + }, + { + "name": "Bus 5C", + "direction": "Husum Torv", + "planned_time": "12:55:00", + "actual_time": "12:53:00" + }, +``` + +Here we get trains, s-trains, busses and the metro.
+With name, direction planned time, and delay / ahead times.
+nice! + -- cgit 1.4.1