我正在使用 api 端点'http://site.api.espn.com/apis/site/v2/sports/basketball/mens-college-basketball/scoreboard'。它只返回前 25 名球队的比赛。知道如何获得所有分区 1 的分数吗?网址是https://www.espn.com/mens-college-basketball/scoreboard/_/group/50。
问问题
127 次
1 回答
1
您需要传入其他参数,因为默认情况下只获得前 25 名。第 1 部分的组看起来是'50'
,您还想增加默认限制:
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()
输出:
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]
于 2021-11-13T10:35:51.183 回答