nba-data

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

NBA Data

NBA数据

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 nba get_scoreboard
sports-skills nba get_standings --season=2025
sports-skills nba get_teams
推荐使用CLI——可避免Python导入路径问题:
bash
sports-skills nba get_scoreboard
sports-skills nba get_standings --season=2025
sports-skills nba 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 NBA 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).
  • Never hardcode a season. Always derive it from the system date.
从系统提示的日期中获取当前年份(例如,
currentDate: 2026-02-18
→ 当前年份为2026)。
  • 如果用户指定了赛季,直接使用该赛季。
  • 如果用户说“当前”、“本赛季”或未指定:NBA赛季为10月至次年6月。如果当前月份是10-12月,活跃赛季年份与当前年份一致;如果是1-6月,活跃赛季始于上一公历年(使用该年份作为赛季)。
  • 切勿硬编码赛季。始终从系统日期推导赛季。

Commands

命令

get_scoreboard

get_scoreboard

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

get_standings

get_standings

Get NBA standings by conference.
  • season
    (int, optional): Season year
Returns
groups[]
with Eastern/Western conferences and team standings including W-L, PCT, GB, streak, home/away/conference records, and PPG.
获取NBA分区排名。
  • season
    (整数,可选):赛季年份
返回包含东西部赛区以及球队排名的
groups[]
数组,排名信息包括胜负场、胜率、胜场差、连胜/连败、主客场/分区战绩和场均得分。

get_teams

get_teams

Get all 30 NBA teams. No parameters.
Returns
teams[]
with id, name, abbreviation, logo, and location.
获取全部30支NBA球队。无参数。
返回包含球队ID、名称、缩写、队徽和所在地的
teams[]
数组。

get_team_roster

get_team_roster

Get full roster for a team.
  • team_id
    (str, required): ESPN team ID (e.g., "13" for Lakers)
Returns
athletes[]
with name, position, jersey number, height, weight, experience.
获取指定球队的完整球员名单。
  • team_id
    (字符串,必填):ESPN球队ID(例如,湖人的ID为“13”)
返回包含球员姓名、位置、球衣号码、身高、体重、球龄的
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 NBA statistical leaders (points, rebounds, assists, etc.).
  • season
    (int, optional): Season year
Returns
categories[]
with leader rankings per stat category.
获取NBA数据榜(得分、篮板、助攻等)。
  • season
    (整数,可选):赛季年份
返回包含各数据类别排名的
categories[]
数组。

get_news

get_news

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

get_schedule

get_schedule

Get NBA 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.
获取指定日期或赛季的NBA赛程。
  • date
    (字符串,可选):日期格式为YYYY-MM-DD
  • season
    (整数,可选):赛季年份(仅在未提供日期时使用)
返回指定日期的
events[]
数组。

Team IDs (Common)

常用球队ID

TeamIDTeamID
Atlanta Hawks1Memphis Grizzlies29
Boston Celtics2Miami Heat14
Brooklyn Nets17Milwaukee Bucks15
Charlotte Hornets30Minnesota Timberwolves16
Chicago Bulls4New Orleans Pelicans3
Cleveland Cavaliers5New York Knicks18
Dallas Mavericks6Oklahoma City Thunder25
Denver Nuggets7Orlando Magic19
Detroit Pistons8Philadelphia 76ers20
Golden State Warriors9Phoenix Suns21
Houston Rockets10Portland Trail Blazers22
Indiana Pacers11Sacramento Kings23
LA Clippers12San Antonio Spurs24
Los Angeles Lakers13Toronto Raptors28
Utah Jazz26Washington Wizards27
球队ID球队ID
亚特兰大老鹰1孟菲斯灰熊29
波士顿凯尔特人2迈阿密热火14
布鲁克林篮网17密尔沃基雄鹿15
夏洛特黄蜂30明尼苏达森林狼16
芝加哥公牛4新奥尔良鹈鹕3
克利夫兰骑士5纽约尼克斯18
达拉斯独行侠6俄克拉荷马城雷霆25
丹佛掘金7奥兰多魔术19
底特律活塞8费城76人20
金州勇士9菲尼克斯太阳21
休斯顿火箭10波特兰开拓者22
印第安纳步行者11萨克拉门托国王23
洛杉矶快船12圣安东尼奥马刺24
洛杉矶湖人13多伦多猛龙28
犹他爵士26华盛顿奇才27

Examples

示例

User: "What are today's NBA scores?"
bash
sports-skills nba get_scoreboard
User: "Show me the Western Conference standings"
bash
sports-skills nba get_standings --season=2025
Then filter results for Western Conference.
User: "Who's on the Lakers roster?"
bash
sports-skills nba get_team_roster --team_id=13
User: "Show me the full box score for last night's Celtics 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
用户:“今天的NBA比分是多少?”
bash
sports-skills nba get_scoreboard
用户:“展示西部赛区排名”
bash
sports-skills nba get_standings --season=2025
然后筛选西部赛区的结果。
用户:“湖人的阵容有哪些人?”
bash
sports-skills nba get_team_roster --team_id=13
用户:“展示昨晚凯尔特人比赛的完整技术统计”
  1. get_scoreboard --date=YYYY-MM-DD
    中获取event_id
  2. 调用
    get_game_summary --event_id=<id>
    获取完整技术统计

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