nhl-data

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

NHL Data

NHL 数据工具

Setup

安装设置

Before first use, check if the CLI is available:
bash
which sports-skills || pip install sports-skills
If
pip install
fails with a Python version error, the package requires Python 3.10+. Find a compatible Python:
bash
python3 --version  # check version
首次使用前,检查CLI是否可用:
bash
which sports-skills || pip install sports-skills
如果
pip install
因Python版本错误失败,说明该包需要Python 3.10及以上版本。请找到兼容的Python版本:
bash
python3 --version  # 检查版本

If < 3.10, try: python3.12 -m pip install sports-skills

如果版本低于3.10,尝试:python3.12 -m pip install sports-skills

On macOS with Homebrew: /opt/homebrew/bin/python3.12 -m pip install sports-skills

在使用Homebrew的macOS上:/opt/homebrew/bin/python3.12 -m pip install sports-skills

No API keys required.
无需API密钥。

Quick Start

快速开始

Prefer the CLI — it avoids Python import path issues:
bash
sports-skills nhl get_scoreboard
sports-skills nhl get_standings --season=2025
sports-skills nhl get_teams
推荐使用CLI——可避免Python导入路径问题:
bash
sports-skills nhl get_scoreboard
sports-skills nhl get_standings --season=2025
sports-skills nhl get_teams

Choosing the Season

赛季选择规则

Derive the current year from the system prompt's date (e.g.,
currentDate: 2026-02-18
→ current year is 2026).
  • If the user specifies a season, use it as-is.
  • If the user says "current", "this season", or doesn't specify: The NHL season runs October–June. If the current month is October–December, the active season year matches the current year. If January–June, the active season started the previous calendar year (use that year as the season).
  • Example: Current date is February 2026 → active season started October 2025 → use season
    2025
    .
  • Never hardcode a season. Always derive it from the system date.
从系统提示的日期中提取当前年份(例如:
currentDate: 2026-02-18
→ 当前年份为2026)。
  • 如果用户指定赛季:直接使用该赛季年份。
  • 如果用户说“当前”、“本赛季”或未指定:NHL赛季为10月至次年6月。若当前月份为10月-12月,活跃赛季年份与当前年份一致;若为1月-6月,活跃赛季始于上一自然年(使用该年份作为赛季参数)。
  • 示例:当前日期为2026年2月 → 活跃赛季始于2025年10月 → 使用赛季参数
    2025
  • 请勿硬编码赛季年份,始终从系统日期推导。

Commands

可用命令

get_scoreboard

get_scoreboard

Get live/recent NHL scores.
  • date
    (str, optional): Date in YYYY-MM-DD format. Defaults to today.
Returns
events[]
with game info, scores, status, and competitors.
获取实时/近期NHL比分。
  • date
    (字符串,可选):格式为YYYY-MM-DD的日期,默认值为今日。
返回包含赛事信息、比分、状态及参赛队伍的
events[]
数组。

get_standings

get_standings

Get NHL standings by conference and division.
  • season
    (int, optional): Season year
Returns
groups[]
with Eastern/Western conferences and division standings including W-L-OTL, points, regulation wins, goals for/against, and streak.
获取NHL按分区和联盟划分的排名。
  • season
    (整数,可选):赛季年份
返回包含东西部联盟及各分区排名的
groups[]
数组,数据包括胜-负-加时负场数、积分、常规时间胜场数、进球数/失球数及连胜/连败情况。

get_teams

get_teams

Get all NHL teams. No parameters.
Returns
teams[]
with id, name, abbreviation, logo, and location.
获取所有NHL球队信息,无参数。
返回包含球队ID、名称、缩写、队徽及所在地的
teams[]
数组。

get_team_roster

get_team_roster

Get full roster for a team.
  • team_id
    (str, required): ESPN team ID (e.g., "21" for Maple Leafs)
Returns
athletes[]
with name, position, jersey number, height, weight, experience, birthplace, and shoots/catches.
获取指定球队的完整球员名单。
  • team_id
    (字符串,必填):ESPN球队ID(例如,枫叶队为"21")
返回包含球员姓名、位置、球衣号码、身高、体重、参赛经验、出生地及惯用手的
athletes[]
数组。

get_team_schedule

get_team_schedule

Get schedule for a specific team.
  • team_id
    (str, required): ESPN team ID
  • season
    (int, optional): Season year
Returns
events[]
with opponent, date, score (if played), and venue.
获取指定球队的赛程。
  • team_id
    (字符串,必填):ESPN球队ID
  • season
    (整数,可选):赛季年份
返回包含对手、日期、比分(已赛赛事)及场馆的
events[]
数组。

get_game_summary

get_game_summary

Get detailed box score and scoring plays.
  • event_id
    (str, required): ESPN event ID
Returns
game_info
,
competitors
,
boxscore
(stats per player),
scoring_plays
, and
leaders
.
获取详细的赛事技术统计及得分战况。
  • event_id
    (字符串,必填):ESPN赛事ID
返回
game_info
competitors
boxscore
(球员个人统计)、
scoring_plays
leaders
数据。

get_leaders

get_leaders

Get NHL statistical leaders (goals, assists, points, etc.).
  • season
    (int, optional): Season year
Returns
categories[]
with leader rankings per stat category.
获取NHL各项数据领跑者(进球、助攻、得分等)。
  • season
    (整数,可选):赛季年份
返回包含各数据类别排名的
categories[]
数组。

get_news

get_news

Get NHL news articles.
  • team_id
    (str, optional): Filter by team
Returns
articles[]
with headline, description, published date, and link.
获取NHL相关新闻文章。
  • team_id
    (字符串,可选):按球队筛选
返回包含标题、摘要、发布日期及链接的
articles[]
数组。

get_play_by_play

get_play_by_play

Get full play-by-play data for a game.
  • event_id
    (str, required): ESPN event ID
Returns play-by-play detail including period, clock, team, play type, and scoring plays.
获取赛事的完整逐场战况数据。
  • event_id
    (字符串,必填):ESPN赛事ID
返回包含节次、时间、球队、战况类型及得分情况的逐场详情。

get_schedule

get_schedule

Get NHL schedule for a specific date or season.
  • date
    (str, optional): Date in YYYY-MM-DD format
  • season
    (int, optional): Season year (used only if no date provided)
Returns
events[]
for the specified date.
获取指定日期或赛季的NHL赛程。
  • date
    (字符串,可选):格式为YYYY-MM-DD的日期
  • season
    (整数,可选):赛季年份(仅在未指定日期时使用)
返回指定日期的
events[]
数组。

get_injuries

get_injuries

Get current NHL injury reports across all teams. No parameters.
Returns
teams[]
with per-team injury lists including player name, position, status (Out/Day-To-Day/IR), injury type, and detail.
获取所有NHL球队的当前伤病报告,无参数。
返回包含各球队伤病名单的
teams[]
数组,数据包括球员姓名、位置、状态(缺阵/每日观察/伤病储备)、伤病类型及详情。

get_transactions

get_transactions

Get recent NHL transactions (trades, signings, waivers).
  • limit
    (int, optional): Max transactions to return. Defaults to 50.
Returns
transactions[]
with date, team, and description.
获取近期NHL交易动态(转会、签约、 waivers)。
  • limit
    (整数,可选):返回的最大交易数量,默认值为50。
返回包含日期、球队及交易描述的
transactions[]
数组。

get_futures

get_futures

Get NHL futures/odds markets (Stanley Cup winner, Hart Trophy, etc.).
  • limit
    (int, optional): Max entries per market. Defaults to 25.
  • season_year
    (int, optional): Season year. Defaults to current.
Returns
futures[]
with market name and entries (team/player name + odds value).
获取NHL投注赔率市场(斯坦利杯冠军、哈特奖等)。
  • limit
    (整数,可选):每个市场返回的最大条目数,默认值为25。
  • season_year
    (整数,可选):赛季年份,默认值为当前赛季。
返回包含市场名称及条目(球队/球员名称 + 赔率值)的
futures[]
数组。

get_team_stats

get_team_stats

Get full team statistical profile for a season.
  • team_id
    (str, required): ESPN team ID
  • season_year
    (int, optional): Season year. Defaults to current.
  • season_type
    (int, optional): 2=regular (default), 3=postseason.
Returns
categories[]
with detailed stats including value, rank, and per-game averages.
获取指定球队在某一赛季的完整统计数据。
  • team_id
    (字符串,必填):ESPN球队ID
  • season_year
    (整数,可选):赛季年份,默认值为当前赛季。
  • season_type
    (整数,可选):2=常规赛(默认),3=季后赛。
返回包含详细统计数据的
categories[]
数组,包括数值、排名及场均数据。

get_player_stats

get_player_stats

Get full player statistical profile for a season.
  • player_id
    (str, required): ESPN athlete ID
  • season_year
    (int, optional): Season year. Defaults to current.
  • season_type
    (int, optional): 2=regular (default), 3=postseason.
Returns
categories[]
with detailed stats including value, rank, and per-game averages.
获取指定球员在某一赛季的完整统计数据。
  • player_id
    (字符串,必填):ESPN球员ID
  • season_year
    (整数,可选):赛季年份,默认值为当前赛季。
  • season_type
    (整数,可选):2=常规赛(默认),3=季后赛。
返回包含详细统计数据的
categories[]
数组,包括数值、排名及场均数据。

Team IDs (Common)

常用球队ID

TeamIDTeamID
Anaheim Ducks25Nashville Predators27
Boston Bruins1New Jersey Devils11
Buffalo Sabres2New York Islanders12
Calgary Flames3New York Rangers13
Carolina Hurricanes7Ottawa Senators14
Chicago Blackhawks4Philadelphia Flyers15
Colorado Avalanche17Pittsburgh Penguins16
Columbus Blue Jackets29San Jose Sharks18
Dallas Stars9Seattle Kraken124292
Detroit Red Wings5St. Louis Blues19
Edmonton Oilers6Tampa Bay Lightning20
Florida Panthers26Toronto Maple Leafs21
Los Angeles Kings8Utah Mammoth129764
Minnesota Wild30Vancouver Canucks22
Montreal Canadiens10Vegas Golden Knights37
Washington Capitals23
Winnipeg Jets28
Tip: Use
get_teams
to get the full, accurate list of team IDs.
球队ID球队ID
Anaheim Ducks25Nashville Predators27
Boston Bruins1New Jersey Devils11
Buffalo Sabres2New York Islanders12
Calgary Flames3New York Rangers13
Carolina Hurricanes7Ottawa Senators14
Chicago Blackhawks4Philadelphia Flyers15
Colorado Avalanche17Pittsburgh Penguins16
Columbus Blue Jackets29San Jose Sharks18
Dallas Stars9Seattle Kraken124292
Detroit Red Wings5St. Louis Blues19
Edmonton Oilers6Tampa Bay Lightning20
Florida Panthers26Toronto Maple Leafs21
Los Angeles Kings8Utah Mammoth129764
Minnesota Wild30Vancouver Canucks22
Montreal Canadiens10Vegas Golden Knights37
Washington Capitals23
Winnipeg Jets28
提示:使用
get_teams
命令获取完整、准确的球队ID列表。

Examples

使用示例

User: "What are today's NHL scores?"
bash
sports-skills nhl get_scoreboard
User: "Show me the Eastern Conference standings"
bash
sports-skills nhl get_standings --season=2025
Then filter results for Eastern Conference.
User: "Who's on the Maple Leafs roster?"
bash
sports-skills nhl get_team_roster --team_id=21
User: "Show me the full box score for last night's Bruins game"
  1. Find the event_id from
    get_scoreboard --date=YYYY-MM-DD
  2. Call
    get_game_summary --event_id=<id>
    for full box score
User: "Who's injured on the Maple Leafs?"
bash
sports-skills nhl get_injuries
Then filter results for Toronto Maple Leafs (team_id=21).
User: "What are the Stanley Cup odds?"
bash
sports-skills nhl get_futures --limit=10
User: "Show me Connor McDavid's stats"
bash
sports-skills nhl get_player_stats --player_id=3895074
用户:“今天的NHL比分是多少?”
bash
sports-skills nhl get_scoreboard
用户:“展示东部联盟的排名”
bash
sports-skills nhl get_standings --season=2025
然后从结果中筛选东部联盟数据。
用户:“枫叶队的阵容有哪些球员?”
bash
sports-skills nhl get_team_roster --team_id=21
用户:“展示昨晚棕熊队比赛的完整技术统计”
  1. 调用
    get_scoreboard --date=YYYY-MM-DD
    获取赛事ID
  2. 调用
    get_game_summary --event_id=<id>
    获取完整技术统计
用户:“枫叶队有哪些球员受伤了?”
bash
sports-skills nhl get_injuries
然后从结果中筛选多伦多枫叶队(team_id=21)的数据。
用户:“斯坦利杯的赔率是多少?”
bash
sports-skills nhl get_futures --limit=10
用户:“展示Connor McDavid的统计数据”
bash
sports-skills nhl get_player_stats --player_id=3895074

Error Handling

错误处理

When a command fails, do not surface raw errors to the user. Instead:
  1. Catch silently and try alternatives
  2. If team name given instead of ID, use
    get_teams
    to find the ID first
  3. Only report failure with a clean message after exhausting alternatives
当命令执行失败时,请勿向用户展示原始错误信息,应按以下步骤处理:
  1. 静默捕获错误并尝试替代方案
  2. 如果用户提供的是球队名称而非ID,先调用
    get_teams
    查找对应ID
  3. 仅在尝试所有替代方案后,向用户展示简洁的失败提示

Troubleshooting

故障排除

  • sports-skills
    command not found
    : Run
    pip install sports-skills
  • Team not found: Use
    get_teams
    to list all teams and find the correct ID
  • No data for future games: ESPN only returns data for completed or in-progress games
  • Offseason:
    get_scoreboard
    returns 0 events — expected. Use
    get_standings
    or
    get_news
    instead.
  • sports-skills
    命令未找到
    :执行
    pip install sports-skills
  • 未找到球队:使用
    get_teams
    命令列出所有球队并查找正确ID
  • 未来赛事无数据:ESPN仅返回已完成或进行中赛事的数据
  • 休赛期
    get_scoreboard
    返回0条赛事数据——此为正常情况,可改用
    get_standings
    get_news
    命令。