dbahn-search 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -14
- package/{db-search.mjs → dbahn-search.mjs} +2 -2
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
#
|
|
1
|
+
# dbahn-search
|
|
2
2
|
|
|
3
3
|
CLI tool for searching Deutsche Bahn train journeys. Built on [db-vendo-client](https://github.com/public-transport/db-vendo-client), the current library for DB's Vendo/Movas API.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install -g
|
|
8
|
+
npm install -g dbahn-search
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
Or run directly with npx:
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
|
-
npx
|
|
14
|
+
npx dbahn-search "Berlin Hbf" "Hamburg Hbf"
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
## Usage
|
|
18
18
|
|
|
19
19
|
```bash
|
|
20
|
-
|
|
20
|
+
dbahn-search <from> <to> [datetime] [options]
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
### Examples
|
|
24
24
|
|
|
25
25
|
```bash
|
|
26
26
|
# Search for trains departing now
|
|
27
|
-
|
|
27
|
+
dbahn-search "Berlin Hbf" "Hamburg Hbf"
|
|
28
28
|
|
|
29
29
|
# Specific date and time
|
|
30
|
-
|
|
30
|
+
dbahn-search "Berlin Hbf" "München Hbf" "2026-04-20 10:00"
|
|
31
31
|
|
|
32
32
|
# Time only (uses today's date)
|
|
33
|
-
|
|
33
|
+
dbahn-search "Frankfurt Hbf" "Köln Hbf" "14:30"
|
|
34
34
|
|
|
35
35
|
# Find cheapest journeys across the day
|
|
36
|
-
|
|
36
|
+
dbahn-search "Berlin Hbf" "München Hbf" "2026-04-20" --bestprice
|
|
37
37
|
|
|
38
38
|
# With BahnCard 50 discount
|
|
39
|
-
|
|
39
|
+
dbahn-search "Berlin Hbf" "Hamburg Hbf" --bahncard 50
|
|
40
40
|
|
|
41
41
|
# With Deutschlandticket
|
|
42
|
-
|
|
42
|
+
dbahn-search "Berlin Hbf" "Dresden Hbf" --deutschlandticket
|
|
43
43
|
|
|
44
44
|
# Combine discounts
|
|
45
|
-
|
|
45
|
+
dbahn-search "Berlin Hbf" "München Hbf" "2026-04-20" --bahncard 50 --deutschlandticket --bestprice
|
|
46
46
|
|
|
47
47
|
# Limit transfers
|
|
48
|
-
|
|
48
|
+
dbahn-search "Marburg (Lahn)" "Berlin Hbf" --transfers 1
|
|
49
49
|
|
|
50
50
|
# JSON output (for scripting)
|
|
51
|
-
|
|
51
|
+
dbahn-search "Berlin Hbf" "Hamburg Hbf" --json
|
|
52
52
|
```
|
|
53
53
|
|
|
54
54
|
### Options
|
|
@@ -83,7 +83,7 @@ Berlin Hbf -> Hamburg Hbf · Sat, 20 Apr 2026
|
|
|
83
83
|
|
|
84
84
|
## How it works
|
|
85
85
|
|
|
86
|
-
|
|
86
|
+
dbahn-search queries Deutsche Bahn's current APIs via [db-vendo-client](https://github.com/public-transport/db-vendo-client). Station names are resolved using both the DB Navigator API and bahn.de's location API (for generating accurate booking links).
|
|
87
87
|
|
|
88
88
|
Prices shown are Sparpreis/Super Sparpreis fares when available. For exact fares and booking, follow the provided bahn.de links.
|
|
89
89
|
|
|
@@ -4,7 +4,7 @@ import {createClient} from 'db-vendo-client';
|
|
|
4
4
|
import {profile as dbnavProfile} from 'db-vendo-client/p/dbnav/index.js';
|
|
5
5
|
import {data as loyaltyCards} from 'db-vendo-client/format/loyalty-cards.js';
|
|
6
6
|
|
|
7
|
-
const client = createClient(dbnavProfile, '
|
|
7
|
+
const client = createClient(dbnavProfile, 'dbahn-search');
|
|
8
8
|
|
|
9
9
|
// --- Argument parsing ---
|
|
10
10
|
|
|
@@ -47,7 +47,7 @@ const [fromQuery, toQuery, ...datetimeParts] = positional;
|
|
|
47
47
|
const datetimeStr = datetimeParts.join(' ') || null;
|
|
48
48
|
|
|
49
49
|
function printUsage() {
|
|
50
|
-
console.log(`Usage:
|
|
50
|
+
console.log(`Usage: dbahn-search <from> <to> [datetime] [options]
|
|
51
51
|
|
|
52
52
|
Arguments:
|
|
53
53
|
from Origin station (e.g. "Berlin Hbf")
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dbahn-search",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "CLI tool to search Deutsche Bahn train journeys with BahnCard and Deutschlandticket support",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
|
-
"
|
|
7
|
+
"dbahn-search": "dbahn-search.mjs"
|
|
8
8
|
},
|
|
9
9
|
"keywords": [
|
|
10
10
|
"deutsche-bahn",
|
|
@@ -22,17 +22,17 @@
|
|
|
22
22
|
"license": "MIT",
|
|
23
23
|
"repository": {
|
|
24
24
|
"type": "git",
|
|
25
|
-
"url": "git+ssh://git@github.com/magalhaesh/
|
|
25
|
+
"url": "git+ssh://git@github.com/magalhaesh/dbahn-search.git"
|
|
26
26
|
},
|
|
27
|
-
"homepage": "https://github.com/magalhaesh/
|
|
27
|
+
"homepage": "https://github.com/magalhaesh/dbahn-search",
|
|
28
28
|
"bugs": {
|
|
29
|
-
"url": "https://github.com/magalhaesh/
|
|
29
|
+
"url": "https://github.com/magalhaesh/dbahn-search/issues"
|
|
30
30
|
},
|
|
31
31
|
"engines": {
|
|
32
32
|
"node": ">=18"
|
|
33
33
|
},
|
|
34
34
|
"files": [
|
|
35
|
-
"
|
|
35
|
+
"dbahn-search.mjs"
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"db-vendo-client": "^6.10.8"
|