微算力 · API 导航与自营网关
API 接入 EN
未登录登录
🚆

德铁时刻查询 · 极速 CLI 方案

Deutsche Bahn CLI · v1.0.0
专业技能 安全 B 级 作者 tobiasbischoff 公开目录收录
下载 2.9k 安装 0 收藏 9.9k 浏览 14
原始页面

简介

德国铁路 CLI 工具,支持查询德铁列车时刻、中转方案与行程规划,适合德国境内及跨境出行。

原始描述

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".

中文使用说明 来自收录源

核心用法

bahn 是一个基于 Node.js 的命令行工具,封装了 db-vendo-client 库,用于查询 Deutsche Bahn(德国铁路)的列车连接信息。用户通过指定出发站、到达站及可选的日期时间参数,即可获取实时的班次、换乘方案、站台信息与行程时长。

主要功能

  • 连接查询:支持任意两德铁车站间的直达/中转方案检索
  • 灵活筛选:可指定日期(--date)、时间(--time)与结果数量(--results)
  • 详细输出:显示发车/到达时刻、站台号、行程时长、换乘次数、列车类型(ICE/IC/RE 等)及经停站
  • 车站智能识别:支持 "Hbf" 缩写、大小写不敏感输入,兼容 "Frankfurt(Main)Hbf" 等复杂站名格式

使用示例

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

显著优点

  1. 数据权威性:直接对接 Deutsche Bahn 官方数据,时刻表准确性与实时性有保障
  2. 查询效率高:CLI 交互方式适合开发者与技术用户快速检索,无需打开网页或 App
  3. 信息密度大:单条结果包含站台、换乘、列车类型等完整出行信息,减少信息断层
  4. 德语场景深度优化:原生支持德铁特有的车站命名规则与列车等级体系

潜在缺点与局限性

  1. 安装依赖复杂:需本地 Node.js 环境,且依赖固定路径 ~/Code/bahn-cli,跨设备迁移不便
  2. 输出格式简陋:纯文本终端输出,缺乏可视化界面;存在 "undefined" 显示瑕疵(已知 issue,不影响功能)
  3. 功能边界明确:仅覆盖德铁网络,不支持欧洲其他铁路公司(如 SNCF、ÖBB)或巴士/航班联运
  4. 无实时动态:未明确提及是否支持晚点、取消等实时状态推送,推测为基础时刻表查询
  5. 国际化不足:界面与站名输出以德语为主,对非德语用户存在使用门槛

适合人群

  • 德国常驻/商旅人士:需要高频查询德铁时刻的技术用户
  • 开发者与自动化需求者:可将 CLI 集成至脚本或工作流,实现出行信息自动化获取
  • 极简主义出行者:偏好终端交互、反感 App 冗余功能的用户

常规风险

  • 本地路径硬编码:~/Code/bahn-cli 的固定依赖可能导致环境不一致时命令失效
  • 数据隐私:通过第三方库 db-vendo-client 请求德铁接口,需关注该库的数据处理政策
  • 维护状态:作为个人/小众 CLI 工具,长期维护与 API 兼容性更新存在不确定性
  • 出行决策风险:CLI 输出的时刻表信息可能不包含实时运营变动,重要行程建议交叉验证 DB Navigator 官方 App

技能正文


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 should be installed globally or in the workspace. If not installed:

cd ~/Code/bahn-cli && npm install

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

正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。

标签

travelclideutsche-bahngermanypublic-transporttrain-scheduletransportation

同类 Skill