nhl-data
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseNHL Data
NHL 数据工具
Setup
安装设置
Before first use, check if the CLI is available:
bash
which sports-skills || pip install sports-skillsIf fails with a Python version error, the package requires Python 3.10+. Find a compatible Python:
pip installbash
python3 --version # check version首次使用前,检查CLI是否可用:
bash
which sports-skills || pip install sports-skills如果因Python版本错误失败,说明该包需要Python 3.10及以上版本。请找到兼容的Python版本:
pip installbash
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_teamsChoosing the Season
赛季选择规则
Derive the current year from the system prompt's date (e.g., → current year is 2026).
currentDate: 2026-02-18- 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.
从系统提示的日期中提取当前年份(例如: → 当前年份为2026)。
currentDate: 2026-02-18- 如果用户指定赛季:直接使用该赛季年份。
- 如果用户说“当前”、“本赛季”或未指定:NHL赛季为10月至次年6月。若当前月份为10月-12月,活跃赛季年份与当前年份一致;若为1月-6月,活跃赛季始于上一自然年(使用该年份作为赛季参数)。
- 示例:当前日期为2026年2月 → 活跃赛季始于2025年10月 → 使用赛季参数。
2025 - 请勿硬编码赛季年份,始终从系统日期推导。
Commands
可用命令
get_scoreboard
get_scoreboard
Get live/recent NHL scores.
- (str, optional): Date in YYYY-MM-DD format. Defaults to today.
date
Returns with game info, scores, status, and competitors.
events[]获取实时/近期NHL比分。
- (字符串,可选):格式为YYYY-MM-DD的日期,默认值为今日。
date
返回包含赛事信息、比分、状态及参赛队伍的数组。
events[]get_standings
get_standings
Get NHL standings by conference and division.
- (int, optional): Season year
season
Returns with Eastern/Western conferences and division standings including W-L-OTL, points, regulation wins, goals for/against, and streak.
groups[]获取NHL按分区和联盟划分的排名。
- (整数,可选):赛季年份
season
返回包含东西部联盟及各分区排名的数组,数据包括胜-负-加时负场数、积分、常规时间胜场数、进球数/失球数及连胜/连败情况。
groups[]get_teams
get_teams
Get all NHL teams. No parameters.
Returns with id, name, abbreviation, logo, and location.
teams[]获取所有NHL球队信息,无参数。
返回包含球队ID、名称、缩写、队徽及所在地的数组。
teams[]get_team_roster
get_team_roster
Get full roster for a team.
- (str, required): ESPN team ID (e.g., "21" for Maple Leafs)
team_id
Returns with name, position, jersey number, height, weight, experience, birthplace, and shoots/catches.
athletes[]获取指定球队的完整球员名单。
- (字符串,必填):ESPN球队ID(例如,枫叶队为"21")
team_id
返回包含球员姓名、位置、球衣号码、身高、体重、参赛经验、出生地及惯用手的数组。
athletes[]get_team_schedule
get_team_schedule
Get schedule for a specific team.
- (str, required): ESPN team ID
team_id - (int, optional): Season year
season
Returns with opponent, date, score (if played), and venue.
events[]获取指定球队的赛程。
- (字符串,必填):ESPN球队ID
team_id - (整数,可选):赛季年份
season
返回包含对手、日期、比分(已赛赛事)及场馆的数组。
events[]get_game_summary
get_game_summary
Get detailed box score and scoring plays.
- (str, required): ESPN event ID
event_id
Returns , , (stats per player), , and .
game_infocompetitorsboxscorescoring_playsleaders获取详细的赛事技术统计及得分战况。
- (字符串,必填):ESPN赛事ID
event_id
返回、、(球员个人统计)、及数据。
game_infocompetitorsboxscorescoring_playsleadersget_leaders
get_leaders
Get NHL statistical leaders (goals, assists, points, etc.).
- (int, optional): Season year
season
Returns with leader rankings per stat category.
categories[]获取NHL各项数据领跑者(进球、助攻、得分等)。
- (整数,可选):赛季年份
season
返回包含各数据类别排名的数组。
categories[]get_news
get_news
Get NHL news articles.
- (str, optional): Filter by team
team_id
Returns with headline, description, published date, and link.
articles[]获取NHL相关新闻文章。
- (字符串,可选):按球队筛选
team_id
返回包含标题、摘要、发布日期及链接的数组。
articles[]get_play_by_play
get_play_by_play
Get full play-by-play data for a game.
- (str, required): ESPN event ID
event_id
Returns play-by-play detail including period, clock, team, play type, and scoring plays.
获取赛事的完整逐场战况数据。
- (字符串,必填):ESPN赛事ID
event_id
返回包含节次、时间、球队、战况类型及得分情况的逐场详情。
get_schedule
get_schedule
Get NHL schedule for a specific date or season.
- (str, optional): Date in YYYY-MM-DD format
date - (int, optional): Season year (used only if no date provided)
season
Returns for the specified date.
events[]获取指定日期或赛季的NHL赛程。
- (字符串,可选):格式为YYYY-MM-DD的日期
date - (整数,可选):赛季年份(仅在未指定日期时使用)
season
返回指定日期的数组。
events[]get_injuries
get_injuries
Get current NHL injury reports across all teams. No parameters.
Returns with per-team injury lists including player name, position, status (Out/Day-To-Day/IR), injury type, and detail.
teams[]获取所有NHL球队的当前伤病报告,无参数。
返回包含各球队伤病名单的数组,数据包括球员姓名、位置、状态(缺阵/每日观察/伤病储备)、伤病类型及详情。
teams[]get_transactions
get_transactions
Get recent NHL transactions (trades, signings, waivers).
- (int, optional): Max transactions to return. Defaults to 50.
limit
Returns with date, team, and description.
transactions[]获取近期NHL交易动态(转会、签约、 waivers)。
- (整数,可选):返回的最大交易数量,默认值为50。
limit
返回包含日期、球队及交易描述的数组。
transactions[]get_futures
get_futures
Get NHL futures/odds markets (Stanley Cup winner, Hart Trophy, etc.).
- (int, optional): Max entries per market. Defaults to 25.
limit - (int, optional): Season year. Defaults to current.
season_year
Returns with market name and entries (team/player name + odds value).
futures[]获取NHL投注赔率市场(斯坦利杯冠军、哈特奖等)。
- (整数,可选):每个市场返回的最大条目数,默认值为25。
limit - (整数,可选):赛季年份,默认值为当前赛季。
season_year
返回包含市场名称及条目(球队/球员名称 + 赔率值)的数组。
futures[]get_team_stats
get_team_stats
Get full team statistical profile for a season.
- (str, required): ESPN team ID
team_id - (int, optional): Season year. Defaults to current.
season_year - (int, optional): 2=regular (default), 3=postseason.
season_type
Returns with detailed stats including value, rank, and per-game averages.
categories[]获取指定球队在某一赛季的完整统计数据。
- (字符串,必填):ESPN球队ID
team_id - (整数,可选):赛季年份,默认值为当前赛季。
season_year - (整数,可选):2=常规赛(默认),3=季后赛。
season_type
返回包含详细统计数据的数组,包括数值、排名及场均数据。
categories[]get_player_stats
get_player_stats
Get full player statistical profile for a season.
- (str, required): ESPN athlete ID
player_id - (int, optional): Season year. Defaults to current.
season_year - (int, optional): 2=regular (default), 3=postseason.
season_type
Returns with detailed stats including value, rank, and per-game averages.
categories[]获取指定球员在某一赛季的完整统计数据。
- (字符串,必填):ESPN球员ID
player_id - (整数,可选):赛季年份,默认值为当前赛季。
season_year - (整数,可选):2=常规赛(默认),3=季后赛。
season_type
返回包含详细统计数据的数组,包括数值、排名及场均数据。
categories[]Team IDs (Common)
常用球队ID
| Team | ID | Team | ID |
|---|---|---|---|
| Anaheim Ducks | 25 | Nashville Predators | 27 |
| Boston Bruins | 1 | New Jersey Devils | 11 |
| Buffalo Sabres | 2 | New York Islanders | 12 |
| Calgary Flames | 3 | New York Rangers | 13 |
| Carolina Hurricanes | 7 | Ottawa Senators | 14 |
| Chicago Blackhawks | 4 | Philadelphia Flyers | 15 |
| Colorado Avalanche | 17 | Pittsburgh Penguins | 16 |
| Columbus Blue Jackets | 29 | San Jose Sharks | 18 |
| Dallas Stars | 9 | Seattle Kraken | 124292 |
| Detroit Red Wings | 5 | St. Louis Blues | 19 |
| Edmonton Oilers | 6 | Tampa Bay Lightning | 20 |
| Florida Panthers | 26 | Toronto Maple Leafs | 21 |
| Los Angeles Kings | 8 | Utah Mammoth | 129764 |
| Minnesota Wild | 30 | Vancouver Canucks | 22 |
| Montreal Canadiens | 10 | Vegas Golden Knights | 37 |
| Washington Capitals | 23 | ||
| Winnipeg Jets | 28 |
Tip: Use to get the full, accurate list of team IDs.
get_teams| 球队 | ID | 球队 | ID |
|---|---|---|---|
| Anaheim Ducks | 25 | Nashville Predators | 27 |
| Boston Bruins | 1 | New Jersey Devils | 11 |
| Buffalo Sabres | 2 | New York Islanders | 12 |
| Calgary Flames | 3 | New York Rangers | 13 |
| Carolina Hurricanes | 7 | Ottawa Senators | 14 |
| Chicago Blackhawks | 4 | Philadelphia Flyers | 15 |
| Colorado Avalanche | 17 | Pittsburgh Penguins | 16 |
| Columbus Blue Jackets | 29 | San Jose Sharks | 18 |
| Dallas Stars | 9 | Seattle Kraken | 124292 |
| Detroit Red Wings | 5 | St. Louis Blues | 19 |
| Edmonton Oilers | 6 | Tampa Bay Lightning | 20 |
| Florida Panthers | 26 | Toronto Maple Leafs | 21 |
| Los Angeles Kings | 8 | Utah Mammoth | 129764 |
| Minnesota Wild | 30 | Vancouver Canucks | 22 |
| Montreal Canadiens | 10 | Vegas Golden Knights | 37 |
| Washington Capitals | 23 | ||
| Winnipeg Jets | 28 |
提示:使用命令获取完整、准确的球队ID列表。
get_teamsExamples
使用示例
User: "What are today's NHL scores?"
bash
sports-skills nhl get_scoreboardUser: "Show me the Eastern Conference standings"
bash
sports-skills nhl get_standings --season=2025Then filter results for Eastern Conference.
User: "Who's on the Maple Leafs roster?"
bash
sports-skills nhl get_team_roster --team_id=21User: "Show me the full box score for last night's Bruins game"
- Find the event_id from
get_scoreboard --date=YYYY-MM-DD - Call for full box score
get_game_summary --event_id=<id>
User: "Who's injured on the Maple Leafs?"
bash
sports-skills nhl get_injuriesThen filter results for Toronto Maple Leafs (team_id=21).
User: "What are the Stanley Cup odds?"
bash
sports-skills nhl get_futures --limit=10User: "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用户:“展示昨晚棕熊队比赛的完整技术统计”
- 调用获取赛事ID
get_scoreboard --date=YYYY-MM-DD - 调用获取完整技术统计
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=3895074Error Handling
错误处理
When a command fails, do not surface raw errors to the user. Instead:
- Catch silently and try alternatives
- If team name given instead of ID, use to find the ID first
get_teams - Only report failure with a clean message after exhausting alternatives
当命令执行失败时,请勿向用户展示原始错误信息,应按以下步骤处理:
- 静默捕获错误并尝试替代方案
- 如果用户提供的是球队名称而非ID,先调用查找对应ID
get_teams - 仅在尝试所有替代方案后,向用户展示简洁的失败提示
Troubleshooting
故障排除
- command not found: Run
sports-skillspip install sports-skills - Team not found: Use to list all teams and find the correct ID
get_teams - No data for future games: ESPN only returns data for completed or in-progress games
- Offseason: returns 0 events — expected. Use
get_scoreboardorget_standingsinstead.get_news
- 命令未找到:执行
sports-skillspip install sports-skills - 未找到球队:使用命令列出所有球队并查找正确ID
get_teams - 未来赛事无数据:ESPN仅返回已完成或进行中赛事的数据
- 休赛期:返回0条赛事数据——此为正常情况,可改用
get_scoreboard或get_standings命令。get_news