nba-data
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseNBA Data
NBA数据
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 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_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 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.
从系统提示的日期中获取当前年份(例如, → 当前年份为2026)。
currentDate: 2026-02-18- 如果用户指定了赛季,直接使用该赛季。
- 如果用户说“当前”、“本赛季”或未指定:NBA赛季为10月至次年6月。如果当前月份是10-12月,活跃赛季年份与当前年份一致;如果是1-6月,活跃赛季始于上一公历年(使用该年份作为赛季)。
- 切勿硬编码赛季。始终从系统日期推导赛季。
Commands
命令
get_scoreboard
get_scoreboard
Get live/recent NBA scores.
- (str, optional): Date in YYYY-MM-DD format. Defaults to today.
date
Returns with game info, scores, status, and competitors.
events[]获取实时/近期NBA比分。
- (字符串,可选):日期格式为YYYY-MM-DD,默认值为今日。
date
返回包含赛事信息、比分、状态和参赛队伍的数组。
events[]get_standings
get_standings
Get NBA standings by conference.
- (int, optional): Season year
season
Returns with Eastern/Western conferences and team standings including W-L, PCT, GB, streak, home/away/conference records, and PPG.
groups[]获取NBA分区排名。
- (整数,可选):赛季年份
season
返回包含东西部赛区以及球队排名的数组,排名信息包括胜负场、胜率、胜场差、连胜/连败、主客场/分区战绩和场均得分。
groups[]get_teams
get_teams
Get all 30 NBA teams. No parameters.
Returns with id, name, abbreviation, logo, and location.
teams[]获取全部30支NBA球队。无参数。
返回包含球队ID、名称、缩写、队徽和所在地的数组。
teams[]get_team_roster
get_team_roster
Get full roster for a team.
- (str, required): ESPN team ID (e.g., "13" for Lakers)
team_id
Returns with name, position, jersey number, height, weight, experience.
athletes[]获取指定球队的完整球员名单。
- (字符串,必填):ESPN球队ID(例如,湖人的ID为“13”)
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 NBA statistical leaders (points, rebounds, assists, etc.).
- (int, optional): Season year
season
Returns with leader rankings per stat category.
categories[]获取NBA数据榜(得分、篮板、助攻等)。
- (整数,可选):赛季年份
season
返回包含各数据类别排名的数组。
categories[]get_news
get_news
Get NBA news articles.
- (str, optional): Filter by team
team_id
Returns with headline, description, published date, and link.
articles[]获取NBA新闻文章。
- (字符串,可选):按球队筛选
team_id
返回包含标题、摘要、发布日期和链接的数组。
articles[]get_schedule
get_schedule
Get NBA 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[]获取指定日期或赛季的NBA赛程。
- (字符串,可选):日期格式为YYYY-MM-DD
date - (整数,可选):赛季年份(仅在未提供日期时使用)
season
返回指定日期的数组。
events[]Team IDs (Common)
常用球队ID
| Team | ID | Team | ID |
|---|---|---|---|
| Atlanta Hawks | 1 | Memphis Grizzlies | 29 |
| Boston Celtics | 2 | Miami Heat | 14 |
| Brooklyn Nets | 17 | Milwaukee Bucks | 15 |
| Charlotte Hornets | 30 | Minnesota Timberwolves | 16 |
| Chicago Bulls | 4 | New Orleans Pelicans | 3 |
| Cleveland Cavaliers | 5 | New York Knicks | 18 |
| Dallas Mavericks | 6 | Oklahoma City Thunder | 25 |
| Denver Nuggets | 7 | Orlando Magic | 19 |
| Detroit Pistons | 8 | Philadelphia 76ers | 20 |
| Golden State Warriors | 9 | Phoenix Suns | 21 |
| Houston Rockets | 10 | Portland Trail Blazers | 22 |
| Indiana Pacers | 11 | Sacramento Kings | 23 |
| LA Clippers | 12 | San Antonio Spurs | 24 |
| Los Angeles Lakers | 13 | Toronto Raptors | 28 |
| Utah Jazz | 26 | Washington Wizards | 27 |
| 球队 | 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_scoreboardUser: "Show me the Western Conference standings"
bash
sports-skills nba get_standings --season=2025Then filter results for Western Conference.
User: "Who's on the Lakers roster?"
bash
sports-skills nba get_team_roster --team_id=13User: "Show me the full box score for last night's Celtics game"
- Find the event_id from
get_scoreboard --date=YYYY-MM-DD - Call for full box score
get_game_summary --event_id=<id>
用户:“今天的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用户:“展示昨晚凯尔特人比赛的完整技术统计”
- 从中获取event_id
get_scoreboard --date=YYYY-MM-DD - 调用获取完整技术统计
get_game_summary --event_id=<id>
Error 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