db-travel

TotalClaw 作者 totalclaw

使用 Deutsche Bahn API (v6.db.transport.rest) 计划穿越德国和欧洲的旅程。涵盖 ICE、IC、区域列车、S-Bahn、U-Bahn、有轨电车、公共汽车、渡轮。在以下情况下使用:(1) 计划在德国或欧洲跨境铁路旅行,(2) 检查德国/欧洲车站的出发/到达板,(3) 查找车站 ID,(4) 导航柏林、慕尼黑、汉堡等城市。触发有关德国火车、DB、BVG、柏林周边交通、欧洲铁路连接的问题。

安装 / 下载方式

TotalClaw CLI推荐
totalclaw install totalclaw:totalclaw~mmichelli-db-travel
cURL直接下载,无需登录
curl -fsSL https://skills.taituai.com/api/skills/totalclaw%3Atotalclaw~mmichelli-db-travel/file -o mmichelli-db-travel.md
## 概述(中文)

使用 Deutsche Bahn API (v6.db.transport.rest) 计划穿越德国和欧洲的旅程。涵盖 ICE、IC、区域列车、S-Bahn、U-Bahn、有轨电车、公共汽车、渡轮。在以下情况下使用:(1) 计划在德国或欧洲跨境铁路旅行,(2) 检查德国/欧洲车站的出发/到达板,(3) 查找车站 ID,(4) 导航柏林、慕尼黑、汉堡等城市。触发有关德国火车、DB、BVG、柏林周边交通、欧洲铁路连接的问题。

## 原文

# DB Travel

Plan journeys across Germany and Europe via the Deutsche Bahn REST API. Covers ICE, IC/EC, regional trains, S-Bahn, U-Bahn, trams, buses, and ferries — with real-time delays.

**No API key required.** Free public API. Rate limit: 100 req/min.

## Script

`scripts/db-travel.py` — standalone Python 3 CLI, no dependencies beyond stdlib.

### Commands

```bash
# Search for stations/stops
python3 scripts/db-travel.py search "Berlin Hbf"

# Plan a trip (place names auto-resolve)
python3 scripts/db-travel.py trip "Berlin Hbf" "Munich Hbf"

# Depart at specific time
python3 scripts/db-travel.py trip "Berlin Hbf" "Flughafen BER" --time "2025-03-01T10:00:00+01:00"

# Arrive by a specific time
python3 scripts/db-travel.py trip "Hamburg" "Berlin" --time "2025-03-01T14:00:00" --arrive

# Departure board
python3 scripts/db-travel.py departures 8011160 --limit 10

# Arrival board
python3 scripts/db-travel.py arrivals 8011160 --duration 60

# Station details
python3 scripts/db-travel.py stop 8011160
```

All output is JSON.

### Common Station IDs

Use `search` to find IDs. Some common ones:
- Berlin Hbf: `8011160`
- München Hbf: `8000261`
- Hamburg Hbf: `8002549`
- Frankfurt (Main) Hbf: `8000105`
- Köln Hbf: `8000207`
- Flughafen BER: `8089110`

### Products

The API returns product types: `nationalExpress` (ICE), `national` (IC/EC), `regionalExpress`, `regional`, `suburban` (S-Bahn), `subway` (U-Bahn), `tram`, `bus`, `ferry`, `taxi`.

## Presenting Results

When presenting trip results to users:
- Show times in HH:MM local format, not ISO
- Summarize legs concisely: "🚄 ICE 507 Berlin Hbf → München Hbf (10:29–14:25, platform 3)"
- Flag delays: if delay_min > 0, mention it
- For departure boards, filter to relevant modes (skip trams if user asked about long-distance)
- Walking legs can usually be omitted unless distance is significant

## Limitations

- Primarily Germany, but includes international trains (IC/EC to neighboring countries)
- Rate limited to 100 req/min — don't hammer it
- No ticket purchasing
- For Norway, use the entur-travel skill instead