15

ESPN hidden API Docs · GitHub

 2 years ago
source link: https://gist.github.com/akeaswaran/b48b02f1c94f873c6655e7129910fc3b
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
ESPN hidden API Docs

ESPN's hidden API endpoints

Football

College Football

Latest News: http://site.api.espn.com/apis/site/v2/sports/football/college-football/news

Latest Scores: http://site.api.espn.com/apis/site/v2/sports/football/college-football/scoreboard

  • query params:

    • calendar: 'blacklist'
    • dates: any date in YYYYMMDD

Game Information: http://site.api.espn.com/apis/site/v2/sports/football/college-football/summary?event=:gameId

  • params:

    • gameId: identifier of some game (EX: 400934572 for 2017 Army vs Navy)

Team Information: http://site.api.espn.com/apis/site/v2/sports/football/college-football/teams/:team

  • params:

    • team: some team abbreviation (EX: 'all' for Allegheny, 'gt' for Georgia Tech, 'wisconsin' for Wisconsin)

Rankings: http://site.api.espn.com/apis/site/v2/sports/football/college-football/rankings

Scores: http://site.api.espn.com/apis/site/v2/sports/football/nfl/scoreboard

News: http://site.api.espn.com/apis/site/v2/sports/football/nfl/news

All Teams: http://site.api.espn.com/apis/site/v2/sports/football/nfl/teams

Specific Team: http://site.api.espn.com/apis/site/v2/sports/football/nfl/teams/:team

Baseball

Scores: http://site.api.espn.com/apis/site/v2/sports/baseball/mlb/scoreboard

News: http://site.api.espn.com/apis/site/v2/sports/baseball/mlb/news

All Teams: http://site.api.espn.com/apis/site/v2/sports/baseball/mlb/teams

Specific Team: http://site.api.espn.com/apis/site/v2/sports/baseball/mlb/teams/:team

College Baseball

Scores: https://site.api.espn.com/apis/site/v2/sports/baseball/college-baseball/scoreboard

Hockey

Scores: http://site.api.espn.com/apis/site/v2/sports/hockey/nhl/scoreboard

News: http://site.api.espn.com/apis/site/v2/sports/hockey/nhl/news

All Teams: http://site.api.espn.com/apis/site/v2/sports/hockey/nhl/teams

Specific Team: http://site.api.espn.com/apis/site/v2/sports/hockey/nhl/teams/:team

Basketball

Scores: http://site.api.espn.com/apis/site/v2/sports/basketball/nba/scoreboard

News: http://site.api.espn.com/apis/site/v2/sports/basketball/nba/news

All Teams: http://site.api.espn.com/apis/site/v2/sports/basketball/nba/teams

Specific Team: http://site.api.espn.com/apis/site/v2/sports/basketball/nba/teams/:team

Scores: http://site.api.espn.com/apis/site/v2/sports/basketball/wnba/scoreboard

News: http://site.api.espn.com/apis/site/v2/sports/basketball/wnba/news

All Teams: http://site.api.espn.com/apis/site/v2/sports/basketball/wnba/teams

Specific Team: http://site.api.espn.com/apis/site/v2/sports/basketball/wnba/teams/:team

Women's College Basketball

Scores: http://site.api.espn.com/apis/site/v2/sports/basketball/womens-college-basketball/scoreboard

News: http://site.api.espn.com/apis/site/v2/sports/basketball/womens-college-basketball/news

All Teams: http://site.api.espn.com/apis/site/v2/sports/basketball/womens-college-basketball/teams

Specific Team: http://site.api.espn.com/apis/site/v2/sports/basketball/womens-college-basketball/teams/:team

Men's College Basketball

Scores: http://site.api.espn.com/apis/site/v2/sports/basketball/mens-college-basketball/scoreboard

News: http://site.api.espn.com/apis/site/v2/sports/basketball/mens-college-basketball/news

All Teams: http://site.api.espn.com/apis/site/v2/sports/basketball/mens-college-basketball/teams

Specific Team: http://site.api.espn.com/apis/site/v2/sports/basketball/mens-college-basketball/teams/:team

Soccer

Scores: http://site.api.espn.com/apis/site/v2/sports/soccer/:league/scoreboard

  • params:

    • league: some league abbreviation (EX: 'eng.1' for EPL, 'usa.1' for MLS)

Latest News: http://site.api.espn.com/apis/site/v2/sports/soccer/:league/news

List of Team Information: http://site.api.espn.com/apis/site/v2/sports/soccer/:league/teams

Will update with more information as I find more...

rondog commented on Feb 23

@bradkimbrell excellent, im glad you found that. Always good when people post their findings

College Baseball

Scores: https://site.api.espn.com/apis/site/v2/sports/baseball/college-baseball/scoreboard
News: https://site.api.espn.com/apis/site/v2/sports/baseball/college-baseball/news
Teams: https://site.api.espn.com/apis/site/v2/sports/baseball/college-baseball/teams
Specific Team: https://site.api.espn.com/apis/site/v2/sports/baseball/college-baseball/teams/:team

Those all work. Scores brings back only Power 5 team games. Every teams group is 26 it looks like. Teams function doesn't bring back every team in Power 5 so you have to add the ?limit={int} parameter. When you select a non-power 5 team using their ID it will show the next game that shows up in scoreboard not their actual next game. Even some power 5 games are not on the scoreboard. I am really not sure how they decided which games cause the games from an invitational are not on the scoreboard.

It seems like there should be an api endpoint for team stats like this https://www.espn.com/mens-college-basketball/team/stats/_/id/221

Can anyone help me find it?

I am curious... does anyone know the correct MLB call to retrieve a list of MLB Homerun leaders? - Thanks!

webmechanic02 commented on Apr 10

edited

@rondog Thanks for taking a look. I think there is a way to pull it using "leaders" but I couldn't get it right. Basically, I am looking to get the info that is on this page https://www.espn.com/mlb/stats/player/_/view/batting/table/batting/sort/homeRuns/dir/desc . I was using the feed from MLB but they changed it up this year and I thought this might be an easier route that working with MLB's new api.
I will take a look at what you sent and see if I can make that work. Thanks again!

@TheeOhioState I went through and got all players (active and non-active) it's here

excellent , can you share the script or php your running to get those IDs? I need to match ESPN NFL Player IDs with another API list of playerIDs , and I'm only able to get Rostered players through the ESPN API and not getting any free agents

ianpherbert commented on Apr 18

edited

@TheeOhioState Unfortunately the only way i found to get all player's id is to call the player endpoint (https://site.web.api.espn.com/apis/common/v3/sports/football/nfl/athletes/{playerId}) and increment the id by 1 each call...
I used a very simple node script to save the players' names with their id.
That being said I have a google script that updates that list with all active players once a day. I can make that lsit public if that is interesting to you.

Any API url for top headlines? I see individual news for each sport but wondering if there was one that holds the top stories across all sports.

stern1978 commented on Apr 26

Has anyone figured out how to get Golf's schedule? The closest I found was https://www.espn.com/golf/schedule/_/season/2022/tour/pga?_xhr=pageContent but you can see technically not part of the API. Its also missing some crucial information like tournament ID (aside from it being displayed in the link field. Specifically for this page: https://www.espn.com/golf/schedule

Is this what you are looking for?
https://site.api.espn.com/apis/site/v2/sports/golf/pga/scoreboard

rondog commented on Apr 26

@stern1978 Yep that looks to be it what I was originally looking for, thank you

TheeOhioState commented on May 5

edited

@ianpherbert think i found a better way to collect all athlete IDs in the ESPN system. I checked and it contains all 2022 rookies , all current free agents , all rostered players and all former players back to when espn starting assigning IDs as far as i can tell.

If you go view the athletes page in v2 API - https://sports.core.api.espn.com/v2/sports/football/leagues/nfl/athletes
There is a list of 25 players

now add query to show 1000 (will not allow limit to be over 1000)
https://sports.core.api.espn.com/v2/sports/football/leagues/nfl/athletes?limit=1000

now add page and count of 1000 , so you can go through 17 pages using "pageCount":17 , about 17000 total former and current and free agent players , all IDs in their system
https://sports.core.api.espn.com/v2/sports/football/leagues/nfl/athletes?limit=1000&page=1
https://sports.core.api.espn.com/v2/sports/football/leagues/nfl/athletes?limit=1000&page=2
...
...

Armed with all the specific IDs you can loop through each player page and see who is active or inactive , or free agent and rostered. Save that info so next pass you can exempt former players if you want to only pass through rostered players and free agents.

Or use V3 which has player info on the initial page
https://sports.core.api.espn.com/v3/sports/football/nfl/athletes?limit=1000&page=1
https://sports.core.api.espn.com/v3/sports/football/nfl/athletes?limit=1000&page=2
...
...

Well hell using V3 same query , you can find EVERY player ID , name on a single page - query allows limit to be over 1000 in v3

https://sports.core.api.espn.com/v3/sports/football/nfl/athletes?limit=20000

I put limit at 20k to allow for new players for next few seasons

This returns all 16000+ players in the system , name , id and DOB for example. I am noticing about 200+ players that have same names and DOB , but different IDs , so ESPN has duplicate IDs for at least 200 players

function GetESPNIds() {
	var url = 'https://sports.core.api.espn.com/v3/sports/football/nfl/athletes?limit=20000';
	$.ajax({
		type: "GET",
      		url: url,
      		success: function (data) {
			for (var i=0;i<data.items.length;i++) {
				if(data.items[i].hasOwnProperty("lastName") && data.items[i].hasOwnProperty("firstName") && data.items[i].hasOwnProperty("dateOfBirth")) {
					console.log("Name: "+data.items[i].lastName+","+data.items[i].firstName +" ID: " +data.items[i].id +" DOB: " +data.items[i].dateOfBirth);
				}
			}
      		}
   	});
}

GetESPNIds();

Anyone know why the API endpoint for the NBA teams does not show all 30 teams?

http://site.api.espn.com/apis/site/v2/sports/basketball/nba/teams

I am only getting 25 teams.

ddivins commented on Jun 4

edited

Thanks everyone. I hope this is allowed, I just published a python script that is the beginning of a ticker just to learn python and json, maybe some will find it helpful (?):
https://github.com/ddivins/SportsTicker

v2k commented on Jun 22

@ianpherbert think i found a better way to collect all athlete IDs in the ESPN system. I checked and it contains all 2022 rookies , all current free agents , all rostered players and all former players back to when espn starting assigning IDs as far as i can tell.

If you go view the athletes page in v2 API - https://sports.core.api.espn.com/v2/sports/football/leagues/nfl/athletes There is a list of 25 players

now add query to show 1000 (will not allow limit to be over 1000) https://sports.core.api.espn.com/v2/sports/football/leagues/nfl/athletes?limit=1000

now add page and count of 1000 , so you can go through 17 pages using "pageCount":17 , about 17000 total former and current and free agent players , all IDs in their system https://sports.core.api.espn.com/v2/sports/football/leagues/nfl/athletes?limit=1000&page=1 https://sports.core.api.espn.com/v2/sports/football/leagues/nfl/athletes?limit=1000&page=2 ... ...

Armed with all the specific IDs you can loop through each player page and see who is active or inactive , or free agent and rostered. Save that info so next pass you can exempt former players if you want to only pass through rostered players and free agents.

Or use V3 which has player info on the initial page https://sports.core.api.espn.com/v3/sports/football/nfl/athletes?limit=1000&page=1 https://sports.core.api.espn.com/v3/sports/football/nfl/athletes?limit=1000&page=2 ... ...

Well hell using V3 same query , you can find EVERY player ID , name on a single page - query allows limit to be over 1000 in v3

https://sports.core.api.espn.com/v3/sports/football/nfl/athletes?limit=20000

I put limit at 20k to allow for new players for next few seasons

This returns all 16000+ players in the system , name , id and DOB for example. I am noticing about 200+ players that have same names and DOB , but different IDs , so ESPN has duplicate IDs for at least 200 players

function GetESPNIds() {
	var url = 'https://sports.core.api.espn.com/v3/sports/football/nfl/athletes?limit=20000';
	$.ajax({
		type: "GET",
      		url: url,
      		success: function (data) {
			for (var i=0;i<data.items.length;i++) {
				if(data.items[i].hasOwnProperty("lastName") && data.items[i].hasOwnProperty("firstName") && data.items[i].hasOwnProperty("dateOfBirth")) {
					console.log("Name: "+data.items[i].lastName+","+data.items[i].firstName +" ID: " +data.items[i].id +" DOB: " +data.items[i].dateOfBirth);
				}
			}
      		}
   	});
}

GetESPNIds();

@TheeOhioState any chance you figured out a way to filter these by team id?

Looking at the NFL scoreboard linked above, I see it's returning 2021 data. Is there a way to specify 2022 at this point or will it just automatically roll over to 2022 nearer to the season actually starting?

hawkseye76 commented on Aug 5

Looking at the NFL scoreboard linked above, I see it's returning 2021 data. Is there a way to specify 2022 at this point or will it just automatically roll over to 2022 nearer to the season actually starting?

It should rollover as it nears the season.

Anyway to get college football season summary stats for the whole team? Looking for the underlying data to this page: https://www.espn.com/college-football/team/stats/_/type/team/id/96

zachnology commented on Aug 16

edited

Anyway to get college football season summary stats for the whole team? Looking for the underlying data to this page: https://www.espn.com/college-football/team/stats/_/type/team/id/96

Unfortunately it looks like that data comes with the page request, not as a separate api call. BUT... I did find api stats here: https://site.api.espn.com/apis/site/v2/sports/football/college-football/teams/96/statistics

College football scoreboard (https://site.api.espn.com/apis/site/v2/sports/football/college-football/scoreboard) seems to only return top 25 games, anyone got ideas for how to get the full scoreboard?

College football scoreboard (https://site.api.espn.com/apis/site/v2/sports/football/college-football/scoreboard) seems to only return top 25 games, anyone got ideas for how to get the full scoreboard?

I'm not seeing today's live games at all in the college football API. Anyone else?

@tsearle7
Yeah the regular scoreboard only has games that have a ranked team, you can pass a dates param and get the full schedule for a certain day:
https://site.api.espn.com/apis/site/v2/sports/football/college-football/scoreboard?dates=20220827

@tsearle7 Yeah the regular scoreboard only has games that have a ranked team, you can pass a dates param and get the full schedule for a certain day: https://site.api.espn.com/apis/site/v2/sports/football/college-football/scoreboard?dates=20220827

Here is the link for "all" games. It seems to have a limit on how many it will pull. You can change the Group=XX to whichever conference you want as shown in the URL @ https://www.espn.com/college-football/scoreboard/_/group/80. (Will change switching conferences in drop down)
FBS
https://site.api.espn.com/apis/site/v2/sports/football/college-football/scoreboard?groups=80

What I've been doing for getting game data after weekend's games is using this endpoint https://site.api.espn.com/apis/site/v2/sports/football/college-football/scoreboard?dates=$start_date-$end_date&limit=200 where $start_date and $end_date are using YYYYMMDD formatting. That lists all games that happened between the given dates (assuming there are less than 200 games between your dates).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK