golf-data
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGolf 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-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 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=pgaImportant: 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
tourtour
参数
tourMost commands require , , or :
--tour=pga--tour=lpga--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 . If they say "women's golf" or "LPGA", use . If they mention the European Tour or DP World Tour, use .
pgalpgaeur大多数命令需要指定、或:
--tour=pga--tour=lpga--tour=eur- PGA:PGA Tour(男子职业高尔夫巡回赛)
- LPGA:LPGA Tour(女子职业高尔夫巡回赛)
- EUR:DP World Tour(前身为欧洲巡回赛)
若用户未指定,默认使用。若用户提及"女子高尔夫"或"LPGA",则使用。若用户提及欧洲巡回赛或DP World Tour,则使用。
pgalpgaeurCommands
命令说明
get_leaderboard
get_leaderboard
Get the current tournament leaderboard with all golfer scores.
- (str, required): "pga", "lpga", or "eur"
tour
Returns the current/most recent tournament with:
- Tournament name, venue, status, current round
- sorted by position with golfer name, country, total score, and round-by-round scores
leaderboard[] - — total number of golfers in the field
field_size
The leaderboard is sorted by position (1 = leader). Each golfer has:
- : Leaderboard rank
position - : Golfer name
name - : Nationality
country - : Total score relative to par (e.g., "-17", "E", "+2")
score - : Array of round scores with stroke count and score-to-par
rounds[]
获取当前赛事的完整排行榜及所有球手成绩。
- (字符串,必填):"pga"、"lpga"或"eur"
tour
返回当前/最近结束的赛事信息,包括:
- 赛事名称、举办场地、状态、当前轮次
- 按排名排序的数组,包含球手姓名、国籍、总成绩及逐轮成绩
leaderboard[] - ——参赛球手总人数
field_size
排行榜按排名排序(1为领先者)。每位球手的信息包括:
- :排行榜排名
position - :球手姓名
name - :国籍
country - :相对于标准杆的总成绩(如"-17"、"E"、"+2")
score - :包含每轮击球次数和相对于标准杆成绩的数组
rounds[]
get_schedule
get_schedule
Get full season tournament schedule.
- (str, required): "pga", "lpga", or "eur"
tour - (int, optional): Season year. Defaults to current.
year
Returns with tournament name, ID, start/end dates. Useful for answering "when is the Masters?" or "what tournaments are coming up?"
tournaments[]获取完整赛季的赛事赛程。
- (字符串,必填):"pga"、"lpga"或"eur"
tour - (整数,可选):赛季年份,默认为当前年份。
year
返回数组,包含赛事名称、ID、开始/结束日期。适用于回答"美国大师赛什么时候举行?"或"接下来有哪些赛事?"这类问题。
tournaments[]get_player_info
get_player_info
Get individual golfer profile.
- (str, required): ESPN athlete ID
player_id - (str, optional): "pga", "lpga", or "eur". Defaults to "pga".
tour
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 ( 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).
idNote: 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.
获取单个高尔夫球手的详细资料。
- (字符串,必填):ESPN运动员ID
player_id - (字符串,可选):"pga"、"lpga"或"eur",默认为"pga"。
tour
返回球手详细信息:姓名、年龄、国籍、出生地、身高/体重、转职业年份、毕业院校、头像URL及ESPN资料链接。
查找球员ID:球员ID会出现在排行榜结果中(每位球手的字段)。也可在ESPN高尔夫页面的URL中找到(例如:espn.com/golf/player/_/id/9478/scottie-scheffler → ID为9478)。
id注意:该命令支持获取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.
- (str, required): ESPN athlete ID
player_id - (str, optional): "pga", "lpga", or "eur". Defaults to "pga".
tour
Returns season statistics (scoring average, earnings, wins, top-10s), world/tour rankings, and recent tournament results.
获取球手的详细概况,包括赛季数据、排名及近期赛事结果。
- (字符串,必填):ESPN运动员ID
player_id - (字符串,可选):"pga"、"lpga"或"eur",默认为"pga"。
tour
返回赛季统计数据(平均杆数、奖金、获胜次数、前十次数)、世界/巡回赛排名及近期赛事结果。
get_scorecard
get_scorecard
Get hole-by-hole scorecard for a golfer in the current/most recent tournament.
- (str, required): "pga", "lpga", or "eur"
tour - (str, required): ESPN athlete ID
player_id
Returns with hole-by-hole scores (strokes, score relative to par) for each completed round.
rounds[]获取当前/最近结束赛事中某球手的逐洞计分卡。
- (字符串,必填):"pga"、"lpga"或"eur"
tour - (字符串,必填):ESPN运动员ID
player_id
返回数组,包含每轮已完成洞的逐洞成绩(击球次数、相对于标准杆的成绩)。
rounds[]get_news
get_news
Get golf news articles.
- (str, required): "pga", "lpga", or "eur"
tour
Returns with headline, description, published date, and link.
articles[]获取高尔夫相关新闻文章。
- (字符串,必填):"pga"、"lpga"或"eur"
tour
返回数组,包含新闻标题、描述、发布日期及链接。
articles[]Common Player IDs
常用球员ID
| Player | ID | Player | ID |
|---|---|---|---|
| Scottie Scheffler | 9478 | Nelly Korda | 9012 |
| Rory McIlroy | 3470 | Jin Young Ko | 9758 |
| Jon Rahm | 9780 | Lydia Ko | 7956 |
| Collin Morikawa | 10592 | Lilia Vu | 9401 |
| Xander Schauffele | 10404 | Nasa Hataoka | 10484 |
| Viktor Hovland | 10503 | Atthaya Thitikul | 10982 |
| Hideki Matsuyama | 5765 | Celine Boutier | 9133 |
| Ludvig Aberg | 4686088 | Lexi Thompson | 6843 |
Tip: Use to find current player IDs from the active tournament.
get_leaderboard| 球员 | ID | 球员 | ID |
|---|---|---|---|
| Scottie Scheffler | 9478 | Nelly Korda | 9012 |
| Rory McIlroy | 3470 | Jin Young Ko | 9758 |
| Jon Rahm | 9780 | Lydia Ko | 7956 |
| Collin Morikawa | 10592 | Lilia Vu | 9401 |
| Xander Schauffele | 10404 | Nasa Hataoka | 10484 |
| Viktor Hovland | 10503 | Atthaya Thitikul | 10982 |
| Hideki Matsuyama | 5765 | Celine Boutier | 9133 |
| Ludvig Aberg | 4686088 | Lexi Thompson | 6843 |
提示:可使用命令从当前赛事中查找最新的球员ID。
get_leaderboardReading 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
大满贯赛事
| Tournament | Months | Course(s) |
|---|---|---|
| The Masters | April | Augusta National |
| PGA Championship | May | Varies |
| U.S. Open | June | Varies |
| The Open Championship | July | Links courses (UK) |
Use and search for these tournament names to find dates and event IDs.
get_schedule| 赛事 | 举办月份 | 球场 |
|---|---|---|
| 美国大师赛(The Masters) | 4月 | 奥古斯塔国家高尔夫俱乐部(Augusta National) |
| PGA锦标赛(PGA Championship) | 5月 | 各球场轮换 |
| 美国公开赛(U.S. Open) | 6月 | 各球场轮换 |
| 英国公开赛(The Open Championship) | 7月 | 英国林克斯球场 |
可使用命令并搜索这些赛事名称来查找举办日期和赛事ID。
get_scheduleExamples
使用示例
User: "What's the PGA leaderboard right now?"
bash
sports-skills golf get_leaderboard --tour=pgaUser: "Show me the LPGA schedule for 2026"
bash
sports-skills golf get_schedule --tour=lpga --year=2026User: "Tell me about Scottie Scheffler"
bash
sports-skills golf get_player_info --player_id=9478User: "When is the Masters this year?"
bash
sports-skills golf get_schedule --tour=pga --year=2026Then search the results for "Masters Tournament".
User: "Show me Scottie Scheffler's scorecard"
bash
sports-skills golf get_scorecard --tour=pga --player_id=9478User: "How has Rory McIlroy been playing this season?"
bash
sports-skills golf get_player_overview --player_id=3470User: "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=pgaError Handling
错误处理
When a command fails, do not surface raw errors to the user. Instead:
- If no active tournament, tell the user and suggest checking the schedule
- If a player ID is wrong, suggest using to find current player IDs
get_leaderboard - Only report failure with a clean message after exhausting alternatives
当命令执行失败时,不要向用户展示原始错误信息。应:
- 若当前无进行中的赛事,告知用户并建议查看赛程
- 若球员ID错误,建议使用命令查找当前赛事的球员ID
get_leaderboard - 在尝试所有备选方案后,仅向用户展示简洁的失败提示
Troubleshooting
故障排除
- command not found: Run
sports-skillspip install sports-skills - No active tournament: Golf tournaments run Thursday–Sunday. Between events, may show no active tournament. Use
get_leaderboardto see upcoming events.get_schedule - Limited round data: Before a tournament starts, round scores will be empty. During the tournament, only completed rounds have scores.
- Player not found: Use to find player IDs from the current field, or look up ESPN golf URLs.
get_leaderboard
- 命令未找到:执行
sports-skills重新安装pip install sports-skills - 无进行中的赛事:高尔夫赛事通常在周四至周日举行。赛事间隙,可能显示无活跃赛事。可使用
get_leaderboard查看即将到来的赛事。get_schedule - 轮次数据有限:赛事开始前,轮次成绩为空。赛事进行中,仅已完成的轮次会有成绩。
- 未找到球员:使用从当前参赛阵容中查找球员ID,或查询ESPN高尔夫页面的URL。
get_leaderboard