简体   繁体   中英

ESPN API Only showing top 25 college basketball scores

im using the api endpoint'http://site.api.espn.com/apis/site/v2/sports/basketball/mens-college-basketball/scoreboard'. It is only returning the games for the top 25 teams. Any idea how to get all division 1 scores? The url for that is https://www.espn.com/mens-college-basketball/scoreboard/_/group/50 .

You need to pass in additional parameters as the default is to just get the top 25. The group for division 1 looks to be '50' , and you also want to increase the default limit too:

import requests

url = 'http://site.api.espn.com/apis/site/v2/sports/basketball/mens-college-basketball/scoreboard'
payload = {
'limit':'500',
'groups':'50'}

jsonData = requests.get(url, params=payload).json()

Output:

import pandas as pd

df = pd.json_normalize(jsonData['events'])
print (df)
           id  ... status.type.altDetail
0   401372032  ...                    OT
1   401372250  ...                   NaN
2   401372164  ...                   NaN
3   401371979  ...                   NaN
4   401369851  ...                   NaN
..        ...  ...                   ...
94  401371252  ...                   NaN
95  401371195  ...                   NaN
96  401373366  ...                   NaN
97  401371131  ...                   NaN
98  401372198  ...                   NaN

[99 rows x 21 columns]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM