hk-gmb-arrival

Real-time arrival information for Hong Kong Green Mini Buses (GMB). Supports fuzzy stop name matching and multi-region route lookup.

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "hk-gmb-arrival" with this command: npx skills add stevenho1394/hk-gmb-arrival

Implementation Notes

API Endpoints (Base URL: https://data.etagmb.gov.hk)

  • GET /route - List all routes grouped by region (HKI, KLN, NT)
  • GET /route/{region}/{route} - Get route details including directions (route_seq) and route_id
  • GET /stop-route/{stop_id} - Get stop names (name_en, name_tc) and the routes serving that stop
  • GET /eta/stop/{stop_id} - Get real-time ETA for all routes at that stop

Additionally, static route data is sourced from:

  • https://hkbus.github.io/hk-bus-crawling/routeFareList.min.json - Contains mapping from route identifiers to stop ID sequences for GMB (and other operators).

Script: gmb_arrival.py

Key functions:

  • searchRoutes(route): Queries /route, finds which regions contain this route number. If none, suggests similar route numbers.
  • get_gmb_arrival(route, direction, stop_name, region):
    1. Fetch /route/{region}/{route} to obtain route_id and the direction details (origin/destination names).
    2. Construct composite route key using the origin/destination English names and load from routeFareList.json to get the ordered list of stop IDs for that direction.
    3. For each stop ID along the route, fetch /stop-route/{stop_id} to retrieve stop names (cached).
    4. Match the user-provided stop_name (case-insensitive) exactly; if not found, perform fuzzy matching and return suggestions.
    5. Once stop ID is identified, call /eta/stop/{stop_id}.
    6. Filter ETA entries for the desired route_id and route_seq (direction), extract up to 3 next arrival timestamps, format as "HH:MM HKT".
    7. Return JSON: { "stopId": "...", "stopName": "...", "arrivals": [ "17:35 HKT", ... ] }.

Caching Strategy

  • routes_all.json: All route list (1 hour)
  • route_details.json: Route details per region/route (5 minutes)
  • routeFareList.json: Static route-to-stop mapping (1 day)
  • stop_names.json: Stop ID to names mapping (1 week)
  • ETA responses: 30 seconds

Cache files stored in data/ subdirectory.

Error Handling

  • Network errors and API failures are caught and reported in JSON with an error field.
  • If route not found: returns found: false with suggestions array.
  • If stop name not found: returns error with suggestions mapping suggestion → stop ID.
  • If no active ETA: returns empty arrivals array with an informative message.

Usage Example (Command Line)

# Search route
python3 gmb_arrival.py searchRoutes 1
# => {"route":"1","found":true,"regions":["HKI","KLN","NT"]}

# Get arrival for route 1 direction 1 (The Peak → Central) at "Hong Kong Station Minibus Terminus" in HKI
python3 gmb_arrival.py getGMBArrival 1 1 "Hong Kong Station Minibus Terminus" HKI
# => {"stopId":"20014492","stopName":"Hong Kong Station Minibus Terminus","arrivals":["14:38 HKT","14:45 HKT","14:52 HKT"]}

Notes

  • Direction sequence: For each GMB route, the API defines route_seq 1 and 2. Use searchRoutes then inspect route details to determine which sequence corresponds to your desired direction, or use getGMBArrival directly if you know the direction number.
  • Stop names are matched case-insensitively. Chinese or English names both work.
  • The static routeFareList may lag behind official data by up to one day but is generally reliable.
  • Rate limits: The script caches aggressively to minimize API calls; still, avoid excessive polling (ETA updates every minute).

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

Multi Edge-TTS CN

Edge-TTS 在线语音合成 skill。基于微软 Edge TTS 引擎,生成速度快(1-2秒),支持多种音色和输出格式。同时支持飞书(OGG/Opus)和企业微信(AMR)。默认音色 xiaoxiao_lively。需联网。

Registry SourceRecently Updated
General

vedic-destiny

吠陀命盘分析中文入口。用于完整命盘研判、命主盘 Rashi chart 与九分盘 Navamsha chart 联读、既往事件回看、出生时间稳定度判断、事业主题、婚姻主题、时空盘专题,以及基于 Jagannatha Hora PDF、星盘截图或文本命盘数据的系统拆盘。当用户提到完整星盘、事业方向、婚姻问题、关系窗...

Registry SourceRecently Updated
General

One Person Company OS

Build a visual operating cockpit for an AI-native one-person company across promise, buyer, product, delivery, cash, learning, and assets. / 为 AI 一人公司建立可视化经营...

Registry SourceRecently Updated
General

健康追踪

健康追踪技能 - 追踪饮水、睡眠、步数等健康数据,JSON存储。

Registry SourceRecently Updated