360 Secure SkillHub
360 安全技能中心

Bahn CLI (Transitous)

该 Skill 指导安装与调用本地 bahn-cli 工具(node index.js),按出发地、目的地、日期、时间和结果数量搜索德国铁路列车连接,返回出发到达时间、站台、时长、换乘次数、中途停站和车次号。后端为 Transitous 的 MOTIS 2 API,需联网执行。

分类:生活
bone187
bone187
热度 19.14
最近更新 2026-06-03 21:29:54

安装

发给 Agent
帮我安装这个技能:npx secure-skills-cli add bone187/bahn-transitous
兼容性
通用兼容
联网要求
需要联网
数据出网
必须出网
Metadata
name
bahn
description
Search Deutsche Bahn train connections using the bahn-cli tool. Use when you need to find train connections between German stations, check departure times, or help with travel planning. Works with station names like "Berlin Hbf", "München", "Hannover".

Deutsche Bahn CLI

Search train connections using the bahn-cli tool.

Installation

The tool lives at ~/Code/bahn-cli/. If not installed:

mkdir -p ~/Code/bahn-cli && cd ~/Code/bahn-cli && npm init -y && npm install

Backend: Uses Transitous (MOTIS 2 API) since June 2026. DB HAFAS was permanently shut down in January 2025.

Usage

Search train connections:

cd ~/Code/bahn-cli && node index.js search "<from>" "<to>" [options]

Options

  • --date YYYY-MM-DD - Departure date (default: today)
  • --time HH:MM - Departure time (default: current time)
  • --results <number> - Number of results to show (default: 5)

Examples

Search connections from Hannover to Bonn:

cd ~/Code/bahn-cli && node index.js search "Hannover Hbf" "Bonn Hbf" --results 3

Search with specific date and time:

cd ~/Code/bahn-cli && node index.js search "Berlin" "München" --date 2026-02-05 --time 14:30

Station Names

  • Use common German station names
  • "Hbf" means Hauptbahnhof (main station)
  • Examples: "Berlin Hbf", "München Hbf", "Frankfurt(Main)Hbf", "Köln Hbf"
  • Station names are case-insensitive

Output

The tool shows:

  • Departure and arrival times
  • Platform numbers
  • Duration
  • Number of changes
  • Intermediate stops for connections with changes
  • Train numbers (ICE, IC, RE, etc.)

Notes

  • The CLI uses the db-vendo-client library
  • Some station names in output may show "undefined" (cosmetic issue, doesn't affect functionality)
  • Direct connections are listed first
  • Times are in 24-hour format