本文介绍了在哪里可以找到 2020 年的 NFL XML 赛程数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直使用 nflgame 和 nfldb 模块从 nfl xml 数据中提取计划,但是我注意到使用以下函数生成的 URL 返回 404 错误.最近有没有其他人经历过这种情况并知道为什么会这样?

I have been pulling schedules from the nfl xml data using the nflgame and nfldb modules, however I noticed that the URLs generated using the below function returns a 404 error. Has anyone else experienced this recently and know why this is the case?

def schedule_url(year, stype, week):
    """
    Returns the NFL.com XML schedule URL. `year` should be an
    integer, `stype` should be one of the strings `PRE`, `REG` or
    `POST`, and `gsis_week` should be a value in the range
    `[0, 17]`.
    """
    xmlurl = 'http://www.nfl.com/ajax/scorestrip?'
    if stype == 'POST':
        week += 17
        if week == 21:  # NFL.com you so silly
            week += 1
    return '%sseason=%d&seasonType=%s&week=%d' % (xmlurl, year, stype, week)

schedule_url(2019, 'REG', 1)

推荐答案

另外,对于未来的游戏,新的站点格式是:

Also, for future games, the new site format is:

https://static.nfl.com/ajax/scorestrip?season=2020&seasonType=REG&week=2

这篇关于在哪里可以找到 2020 年的 NFL XML 赛程数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-09 08:27