News:

Welcome to the Golf Club Atlas Discussion Group!

Each user is approved by the Golf Club Atlas editorial staff. For any new inquiries, please contact us.


Wayne_Kozun

  • Karma: +0/-0
OT - Anyone know of an API where you can get golf scores?
« on: April 10, 2021, 11:18:36 AM »
It would be great to be able to automatically pull in golf scores from the Masters (and other tunamints) to do real-time scoring for the golf pool that I run with my friends.  Does anyone know of an API where you can pull in this data?
I found something but I can't get it working, and Jaco's website doesn't seem to be live and the Github site is archived.
Quote
For the PGA Tour, you can use their internal API . For the current tournament ID, use https://statdata.pgatour.com/r/current/message.json and get the tid (tournament ID). Then use that in https://statdata.pgatour.com/r/<tid>/leaderboard-v2mini.json. Note this is not public API and can change at any moment. I used this in March 2018. To get other tours’ leaderboards, replace the r in the first request. A little dev-tools inspection on pgatour.com will reveal all you need.
Update: I’ve made a little app to display the live leaderboards from both the PGA and European tours: https://golf.jacoduplessis.co.za. The data can also be retrieved as JSON at the following URL: https://golf.jacoduplessis.co.za/?format=json. The source code is here: https://github.com/jacoduplessis/golf.

Ben Hollerbach

  • Karma: +0/-0
Re: OT - Anyone know of an API where you can get golf scores?
« Reply #1 on: April 10, 2021, 01:19:13 PM »
I'm not sure if it's realtime, but investigate this ESPN API

Joe Zucker

  • Karma: +0/-0
Re: OT - Anyone know of an API where you can get golf scores?
« Reply #2 on: April 10, 2021, 09:48:57 PM »
Depending on your needs, you can use Google sheet's "importhtml" function.  If you are manipulating the data in Gsheets, this imports the leaderboard table into a sheet, then any manipulation or calculations can be done in reference to this data pull, which updates as often as the ESPN site.  Message me if you want more details on this, as it's what I use for a pool.

Wayne_Kozun

  • Karma: +0/-0
Re: OT - Anyone know of an API where you can get golf scores?
« Reply #3 on: April 11, 2021, 02:04:52 PM »
Thanks Joe, that seems to kind of work, but every other line is kind of garbage.  And the players' names are listed twice.  I am using =[/size]IMPORTHTML[/color][/size]([/color][/size]"https://www.cbssports.com/golf/leaderboard/"[/color][/size],[/color][/size]"table"[/color][/size],[/color][/size]1[/color][/size]).[/color][/size][/color][/size]Any idea if this is possible in Excel? I tried using Get Data from Web using the CBS site but it didn'tload anything.
[/color][/size][/color][/size]What source web page are you using?  Here is what I get:[/color]
[/size][/color][/size]

[/t]posctrynameto parthrutodayr1r2r3r4total
[/size]

[/t]
[/size]
1

H. MatsuyamaHideki Matsuyama
-11
-
14:40
69
71
65
-
205
1234


   - Eagle
   - Birdie
   - Bogey
   - Double Bogey +[/t]










[/font][/size]

[/t]T2
X. SchauffeleXander Schauffele
[/size]
-7
-
14:40
72
69
68
-
209
1234


   - Eagle
   - Birdie
   - Bogey
   - Double Bogey +[/t]










[/font][/size]

[/t]T2
M. LeishmanMarc Leishman
[/size]
-7
-
14:30
72
67
70
-
209
1234


   - Eagle
   - Birdie
   - Bogey
   - Double Bogey +[/t]










[/font][/size]

[/t]T2
W. ZalatorisWill Zalatoris
[/size]
-7
-
14:20
70
68
71
-
209
1234


   - Eagle
   - Birdie
   - Bogey
   - Double Bogey +[/t]










[/font][/size]

[/t]T2
J. RoseJustin Rose
[/size]
-7
-
14:30
65
72
72
-
209

Wayne_Kozun

  • Karma: +0/-0
Re: OT - Anyone know of an API where you can get golf scores?
« Reply #4 on: April 11, 2021, 02:06:07 PM »
Well that paste didn't work very well!  Every other line kind of has what I want, but it keeps putting in a line with 1234


   - Eagle
   - Birdie
   - Bogey
   - Double Bogey +[/font][/size]

Joe Zucker

  • Karma: +0/-0
Re: OT - Anyone know of an API where you can get golf scores?
« Reply #5 on: April 11, 2021, 10:07:53 PM »
Hi Wayne, I am currently using ESPN's leaderborad page.  Sadly, I often have to change and find new ones as some sites block the auto queries and others change their format.  But for 2021, ESPN seems to be working fine.  I enter this and it get's me a clean page of the leaderboard, nicely placed into cells.

=importhtml("https://www.espn.com/golf/leaderboard/_/tournamentId/401243005","table",1)
« Last Edit: April 11, 2021, 10:10:25 PM by Joe Zucker »