360 Secure SkillHub
360 安全技能中心

NS Trains

调用荷兰 NS 官方 API 的 Node 脚本集合,支持通勤快捷查询、任意两站行程规划、车站出发/到达列表、车站名搜索与实时中断信息,输出时刻、延误、换乘、站台和拥挤度预报;需自备 NS_SUBSCRIPTION_KEY 并联网。

eggressive
eggressive
热度 78.76
最近更新 2026-05-11 15:51:31
分类:生活依赖:代码执行 / 第三方 API应用场景:旅行 / 日程安排

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add ns-trains
Metadata
name
ns-trains
description
Check Dutch train schedules, departures, disruptions, and plan journeys using the NS API. Perfect for daily commute checks.
metadata
{"openclaw":{"emoji":"🚆","requires":{"bins":["node"],"env":["NS_SUBSCRIPTION_KEY"]},"primaryEnv":"NS_SUBSCRIPTION_KEY"}}

NS Trains Skill

Check Dutch train schedules, departures, disruptions, and plan journeys using the official NS (Nederlandse Spoorwegen) API.

Setup

1. Get an NS subscription key

  1. Go to NS API Portal
  2. Create an account and subscribe to the Ns-App product (free tier available)
  3. Copy your Primary Key

2. Set Environment Variables

export NS_SUBSCRIPTION_KEY="your-subscription-key-here"   # preferred
# Back-compat:
export NS_API_KEY="$NS_SUBSCRIPTION_KEY"                   # legacy name still supported

# Optional: Configure commute stations for quick shortcuts
export NS_HOME_STATION="Utrecht Centraal"
export NS_WORK_STATION="Amsterdam Zuid"

For security, prefer injecting these env vars via your runtime secret mechanism rather than committing them anywhere. Avoid printing or sharing your subscription key.

Quick Usage

🚆 Commute shortcuts

node {baseDir}/scripts/commute.mjs --to-work   # Morning: Home → Work
node {baseDir}/scripts/commute.mjs --to-home   # Evening: Work → Home

Plan any journey

node {baseDir}/scripts/journey.mjs --from "Utrecht Centraal" --to "Amsterdam Zuid"

Check departures from a station

node {baseDir}/scripts/departures.mjs --station "Amsterdam Centraal"

Check arrivals at a station

node {baseDir}/scripts/arrivals.mjs --station "Rotterdam Centraal"

Search for stations

node {baseDir}/scripts/stations.mjs amsterdam
node {baseDir}/scripts/stations.mjs --search "den haag"

Check current disruptions

node {baseDir}/scripts/disruptions.mjs
node {baseDir}/scripts/disruptions.mjs --from "Utrecht" --to "Amsterdam"

Natural Language

Just ask:

  • "When is the next train to Amsterdam?"
  • "Check trains from Utrecht to Rotterdam"
  • "Any train disruptions today?"
  • "Plan my commute to work"
  • "What time does the train arrive?"

Output

Returns journey options with:

  • Departure/arrival times
  • Real-time delays
  • Duration
  • Transfers
  • Platform numbers
  • Disruption warnings
  • Crowdedness forecast (🟢 low / 🟡 medium / 🔴 high)

Commands Reference

Command Description
commute.mjs [work|home] Quick commute check (requires NS_HOME_STATION & NS_WORK_STATION)
journey.mjs --from X --to Y Plan a journey between any stations
departures.mjs --station X List departures from a station
arrivals.mjs --station X List arrivals at a station
stations.mjs [query] Search for station names
disruptions.mjs Check current disruptions

API Endpoints Used

  • /reisinformatie-api/api/v3/trips - Journey planning
  • /reisinformatie-api/api/v2/arrivals - Arrivals
  • /reisinformatie-api/api/v2/departures - Departures
  • /reisinformatie-api/api/v3/disruptions - Disruptions
  • /reisinformatie-api/api/v2/stations - Station search

Reference