golf-data

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Golf Data (PGA / LPGA / DP World Tour)

高尔夫赛事数据(PGA / LPGA / DP World Tour)

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 golf get_leaderboard --tour=pga
sports-skills golf get_schedule --tour=pga --year=2026
sports-skills golf get_news --tour=pga
推荐使用CLI——可避免Python导入路径问题:
bash
sports-skills golf get_leaderboard --tour=pga
sports-skills golf get_schedule --tour=pga --year=2026
sports-skills golf get_news --tour=pga

Important: Golf is Not a Team Sport

重要提示:高尔夫并非团队运动

Golf data is fundamentally different from team sports (NFL, NBA, etc.):
  • Tournaments, not games: Each event is a multi-day tournament (typically 4 rounds, Thu–Sun).
  • Individual athletes: The leaderboard has 72–147 individual golfers, not 2 teams.
  • Score relative to par: Scores are strings like "-17", "E" (even), "+2" — not point totals.
  • Round-by-round scoring: Each golfer has 4 round scores (stroke count and score-to-par).
  • One event per week: Unlike team sports with multiple games per day, golf has one tournament per week per tour.
  • No standings/rankings endpoint: FedEx Cup standings are not available via this API.
高尔夫赛事数据与团队运动(如NFL、NBA等)有本质区别:
  • 赛事而非比赛:每个赛事是多日进行的锦标赛(通常为4轮,周四至周日)。
  • 个人运动员:排行榜包含72-147名个人高尔夫球手,而非两支队伍。
  • 相对于标准杆的成绩:成绩为"-17"、"E"(平标准杆)、"+2"这类字符串,而非总得分。
  • 逐轮计分:每位球手有4轮成绩(击球次数和相对于标准杆的成绩)。
  • 每周一个赛事:与团队运动每日多场比赛不同,每个巡回赛每周仅举办一场赛事。
  • 无排名/积分榜接口:FedEx Cup积分榜无法通过此API获取。

The
tour
Parameter

tour
参数

Most commands require
--tour=pga
,
--tour=lpga
, or
--tour=eur
:
  • PGA: PGA Tour (men's professional golf)
  • LPGA: LPGA Tour (women's professional golf)
  • EUR: DP World Tour (formerly European Tour)
If the user doesn't specify, default to
pga
. If they say "women's golf" or "LPGA", use
lpga
. If they mention the European Tour or DP World Tour, use
eur
.
大多数命令需要指定
--tour=pga
--tour=lpga
--tour=eur
  • PGA:PGA Tour(男子职业高尔夫巡回赛)
  • LPGA:LPGA Tour(女子职业高尔夫巡回赛)
  • EUR:DP World Tour(前身为欧洲巡回赛)
若用户未指定,默认使用
pga
。若用户提及"女子高尔夫"或"LPGA",则使用
lpga
。若用户提及欧洲巡回赛或DP World Tour,则使用
eur

Commands

命令说明

get_leaderboard

get_leaderboard

Get the current tournament leaderboard with all golfer scores.
  • tour
    (str, required): "pga", "lpga", or "eur"
Returns the current/most recent tournament with:
  • Tournament name, venue, status, current round
  • leaderboard[]
    sorted by position with golfer name, country, total score, and round-by-round scores
  • field_size
    — total number of golfers in the field
The leaderboard is sorted by position (1 = leader). Each golfer has:
  • position
    : Leaderboard rank
  • name
    : Golfer name
  • country
    : Nationality
  • score
    : Total score relative to par (e.g., "-17", "E", "+2")
  • rounds[]
    : Array of round scores with stroke count and score-to-par
获取当前赛事的完整排行榜及所有球手成绩。
  • tour
    (字符串,必填):"pga"、"lpga"或"eur"
返回当前/最近结束的赛事信息,包括:
  • 赛事名称、举办场地、状态、当前轮次
  • 按排名排序的
    leaderboard[]
    数组,包含球手姓名、国籍、总成绩及逐轮成绩
  • field_size
    ——参赛球手总人数
排行榜按排名排序(1为领先者)。每位球手的信息包括:
  • position
    :排行榜排名
  • name
    :球手姓名
  • country
    :国籍
  • score
    :相对于标准杆的总成绩(如"-17"、"E"、"+2")
  • rounds[]
    :包含每轮击球次数和相对于标准杆成绩的数组

get_schedule

get_schedule

Get full season tournament schedule.
  • tour
    (str, required): "pga", "lpga", or "eur"
  • year
    (int, optional): Season year. Defaults to current.
Returns
tournaments[]
with tournament name, ID, start/end dates. Useful for answering "when is the Masters?" or "what tournaments are coming up?"
获取完整赛季的赛事赛程。
  • tour
    (字符串,必填):"pga"、"lpga"或"eur"
  • year
    (整数,可选):赛季年份,默认为当前年份。
返回
tournaments[]
数组,包含赛事名称、ID、开始/结束日期。适用于回答"美国大师赛什么时候举行?"或"接下来有哪些赛事?"这类问题。

get_player_info

get_player_info

Get individual golfer profile.
  • player_id
    (str, required): ESPN athlete ID
  • tour
    (str, optional): "pga", "lpga", or "eur". Defaults to "pga".
Returns golfer details: name, age, nationality, birthplace, height/weight, turned pro year, college, headshot URL, and ESPN profile link.
Finding player IDs: Player IDs appear in leaderboard results (
id
field on each golfer). You can also find them in ESPN golf URLs (e.g., espn.com/golf/player/_/id/9478/scottie-scheffler → ID is 9478).
Note: Player profiles work for PGA Tour and DP World Tour golfers. LPGA player profiles are not available through ESPN's API — the command will automatically try PGA and EUR tours as fallback.
获取单个高尔夫球手的详细资料。
  • player_id
    (字符串,必填):ESPN运动员ID
  • tour
    (字符串,可选):"pga"、"lpga"或"eur",默认为"pga"。
返回球手详细信息:姓名、年龄、国籍、出生地、身高/体重、转职业年份、毕业院校、头像URL及ESPN资料链接。
查找球员ID:球员ID会出现在排行榜结果中(每位球手的
id
字段)。也可在ESPN高尔夫页面的URL中找到(例如:espn.com/golf/player/_/id/9478/scottie-scheffler → ID为9478)。
注意:该命令支持获取PGA Tour和DP World Tour球手的资料。LPGA球手的资料无法通过ESPN的API获取——命令会自动尝试以PGA和EUR巡回赛作为备选。

get_player_overview

get_player_overview

Get detailed golfer overview with season stats, rankings, and recent results.
  • player_id
    (str, required): ESPN athlete ID
  • tour
    (str, optional): "pga", "lpga", or "eur". Defaults to "pga".
Returns season statistics (scoring average, earnings, wins, top-10s), world/tour rankings, and recent tournament results.
获取球手的详细概况,包括赛季数据、排名及近期赛事结果。
  • player_id
    (字符串,必填):ESPN运动员ID
  • tour
    (字符串,可选):"pga"、"lpga"或"eur",默认为"pga"。
返回赛季统计数据(平均杆数、奖金、获胜次数、前十次数)、世界/巡回赛排名及近期赛事结果。

get_scorecard

get_scorecard

Get hole-by-hole scorecard for a golfer in the current/most recent tournament.
  • tour
    (str, required): "pga", "lpga", or "eur"
  • player_id
    (str, required): ESPN athlete ID
Returns
rounds[]
with hole-by-hole scores (strokes, score relative to par) for each completed round.
获取当前/最近结束赛事中某球手的逐洞计分卡。
  • tour
    (字符串,必填):"pga"、"lpga"或"eur"
  • player_id
    (字符串,必填):ESPN运动员ID
返回
rounds[]
数组,包含每轮已完成洞的逐洞成绩(击球次数、相对于标准杆的成绩)。

get_news

get_news

Get golf news articles.
  • tour
    (str, required): "pga", "lpga", or "eur"
Returns
articles[]
with headline, description, published date, and link.
获取高尔夫相关新闻文章。
  • tour
    (字符串,必填):"pga"、"lpga"或"eur"
返回
articles[]
数组,包含新闻标题、描述、发布日期及链接。

Common Player IDs

常用球员ID

PlayerIDPlayerID
Scottie Scheffler9478Nelly Korda9012
Rory McIlroy3470Jin Young Ko9758
Jon Rahm9780Lydia Ko7956
Collin Morikawa10592Lilia Vu9401
Xander Schauffele10404Nasa Hataoka10484
Viktor Hovland10503Atthaya Thitikul10982
Hideki Matsuyama5765Celine Boutier9133
Ludvig Aberg4686088Lexi Thompson6843
Tip: Use
get_leaderboard
to find current player IDs from the active tournament.
球员ID球员ID
Scottie Scheffler9478Nelly Korda9012
Rory McIlroy3470Jin Young Ko9758
Jon Rahm9780Lydia Ko7956
Collin Morikawa10592Lilia Vu9401
Xander Schauffele10404Nasa Hataoka10484
Viktor Hovland10503Atthaya Thitikul10982
Hideki Matsuyama5765Celine Boutier9133
Ludvig Aberg4686088Lexi Thompson6843
提示:可使用
get_leaderboard
命令从当前赛事中查找最新的球员ID。

Reading Leaderboard Scores

解读排行榜成绩

Golf scores are relative to par. Example response:
json
{
  "leaderboard": [
    {"position": 1, "name": "Scottie Scheffler", "country": "United States", "score": "-17",
     "rounds": [
       {"round": 1, "strokes": 63, "score": "-8"},
       {"round": 2, "strokes": 68, "score": "-3"},
       {"round": 3, "strokes": 67, "score": "-4"},
       {"round": 4, "strokes": 70, "score": "-1"}
     ]},
    {"position": 2, "name": "Rory McIlroy", "country": "Northern Ireland", "score": "-15", ...}
  ]
}
  • Negative score = under par (good). "-17" means 17 strokes under par.
  • "E" = even par.
  • Positive score = over par. "+2" means 2 strokes over par.
  • Strokes = actual stroke count for that round (par 72 course → 63 strokes = -9).
高尔夫成绩以相对于标准杆的数值表示。示例响应:
json
{
  "leaderboard": [
    {"position": 1, "name": "Scottie Scheffler", "country": "United States", "score": "-17",
     "rounds": [
       {"round": 1, "strokes": 63, "score": "-8"},
       {"round": 2, "strokes": 68, "score": "-3"},
       {"round": 3, "strokes": 67, "score": "-4"},
       {"round": 4, "strokes": 70, "score": "-1"}
     ]},
    {"position": 2, "name": "Rory McIlroy", "country": "Northern Ireland", "score": "-15", ...}
  ]
}
  • 负分:低于标准杆(成绩优秀)。"-17"表示比标准杆少17杆。
  • "E":平标准杆。
  • 正分:高于标准杆。"+2"表示比标准杆多2杆。
  • Strokes:该轮实际击球次数(标准杆72杆的球场→63杆即-9杆)。

Major Championships

大满贯赛事

TournamentMonthsCourse(s)
The MastersAprilAugusta National
PGA ChampionshipMayVaries
U.S. OpenJuneVaries
The Open ChampionshipJulyLinks courses (UK)
Use
get_schedule
and search for these tournament names to find dates and event IDs.
赛事举办月份球场
美国大师赛(The Masters)4月奥古斯塔国家高尔夫俱乐部(Augusta National)
PGA锦标赛(PGA Championship)5月各球场轮换
美国公开赛(U.S. Open)6月各球场轮换
英国公开赛(The Open Championship)7月英国林克斯球场
可使用
get_schedule
命令并搜索这些赛事名称来查找举办日期和赛事ID。

Examples

使用示例

User: "What's the PGA leaderboard right now?"
bash
sports-skills golf get_leaderboard --tour=pga
User: "Show me the LPGA schedule for 2026"
bash
sports-skills golf get_schedule --tour=lpga --year=2026
User: "Tell me about Scottie Scheffler"
bash
sports-skills golf get_player_info --player_id=9478
User: "When is the Masters this year?"
bash
sports-skills golf get_schedule --tour=pga --year=2026
Then search the results for "Masters Tournament".
User: "Show me Scottie Scheffler's scorecard"
bash
sports-skills golf get_scorecard --tour=pga --player_id=9478
User: "How has Rory McIlroy been playing this season?"
bash
sports-skills golf get_player_overview --player_id=3470
User: "Latest golf news"
bash
sports-skills golf get_news --tour=pga
用户:"当前PGA的排行榜是什么情况?"
bash
sports-skills golf get_leaderboard --tour=pga
用户:"给我看看2026年LPGA的赛程"
bash
sports-skills golf get_schedule --tour=lpga --year=2026
用户:"介绍一下Scottie Scheffler"
bash
sports-skills golf get_player_info --player_id=9478
用户:"今年美国大师赛什么时候举行?"
bash
sports-skills golf get_schedule --tour=pga --year=2026
然后在结果中搜索"Masters Tournament"。
用户:"给我看看Scottie Scheffler的计分卡"
bash
sports-skills golf get_scorecard --tour=pga --player_id=9478
用户:"最新的高尔夫新闻"
bash
sports-skills golf get_news --tour=pga

Error Handling

错误处理

When a command fails, do not surface raw errors to the user. Instead:
  1. If no active tournament, tell the user and suggest checking the schedule
  2. If a player ID is wrong, suggest using
    get_leaderboard
    to find current player IDs
  3. Only report failure with a clean message after exhausting alternatives
当命令执行失败时,不要向用户展示原始错误信息。应:
  1. 若当前无进行中的赛事,告知用户并建议查看赛程
  2. 若球员ID错误,建议使用
    get_leaderboard
    命令查找当前赛事的球员ID
  3. 在尝试所有备选方案后,仅向用户展示简洁的失败提示

Troubleshooting

故障排除

  • sports-skills
    command not found
    : Run
    pip install sports-skills
  • No active tournament: Golf tournaments run Thursday–Sunday. Between events,
    get_leaderboard
    may show no active tournament. Use
    get_schedule
    to see upcoming events.
  • Limited round data: Before a tournament starts, round scores will be empty. During the tournament, only completed rounds have scores.
  • Player not found: Use
    get_leaderboard
    to find player IDs from the current field, or look up ESPN golf URLs.
  • sports-skills
    命令未找到
    :执行
    pip install sports-skills
    重新安装
  • 无进行中的赛事:高尔夫赛事通常在周四至周日举行。赛事间隙,
    get_leaderboard
    可能显示无活跃赛事。可使用
    get_schedule
    查看即将到来的赛事。
  • 轮次数据有限:赛事开始前,轮次成绩为空。赛事进行中,仅已完成的轮次会有成绩。
  • 未找到球员:使用
    get_leaderboard
    从当前参赛阵容中查找球员ID,或查询ESPN高尔夫页面的URL。