示例#1
0
def getext(gameid):
    '''
    Really this is the recap page, but also grabs some other info like game
    location and time, etc; also story analysis of game;
    '''
    try:
        url = nba_ext + str(gameid)
        print url
        ext = toStrucDocESPNPages.structureESPNPage(url)
        return ext
    except ValueError:
        # need some stuff to spit out error info...
        print('Failed to retreive recap for game ' + str(gameid))
        return dict()
示例#2
0
def getbox(gameid):
    '''
    Given an ESPN game ID grabs the box score feed page, turns it into
    a structured doc;
    '''
    try:
        url = nba_box + str(gameid)
        print url
        box = toStrucDocESPNPages.structureESPNPage(url)
        return box
    except ValueError:
        # need some stuff to spit out error info...
        print('Failed to retreive box score for game ' + str(gameid))
        return dict()
示例#3
0
def getsht(gameid):
    '''
    Given an ESPN game ID grabs the shot placement for the game; makes
    structured doc;
    '''
    try:
        url = nba_shots + str(gameid)
        print url
        box = toStrucDocESPNPages.structureESPNPage(url)
        return box
    except ValueError:
        # need some stuff to spit out error info...
        print('Failed to retreive box score for game ' + str(gameid))
        return list()
示例#4
0
def getpbp(gameid):
    '''
    Given an ESPN game ID grabs play-by-play page, forms it into a
    structured doc;
    '''
    try:
        url = nba_pbp + str(gameid) + "&period=0"
        print url
        pbp = toStrucDocESPNPages.structureESPNPage(url)
        return pbp
    except ValueError:
        # need some stuff to spit out error info...
        print('Failed to retreive play-by-play for game ' + str(gameid))
        return dict()