Пример #1
0
 def makeSoup(self):
     if self.ptype == 'shots':
         soup = soupFromUrl(self.url, parser='xml')
         self.goodSoup = soup['pass']
         self.soup = soup['soup']
     else:
         soup = soupFromUrl(self.url, hdr=True)
         self.goodSoup = soup['pass']
         self.soup = soup['soup']
 def makeSoup(self):
     if self.ptype == 'shots':
         soup = soupFromUrl(self.url, parser='xml')
         self.goodSoup = soup['pass']
         self.soup = soup['soup']
     else:
         soup = soupFromUrl(self.url, hdr=True)
         self.goodSoup = soup['pass']
         self.soup = soup['soup']        
Пример #3
0
def processESPNShotsPage(url):
    '''
    Handles grabbing the x,y coords from the ESPN shots page;
    returns a dict;
    '''
    shotSoup = soupFromUrl(url, parser='xml')['soup']
    shots = shotSoup.findAll('Shot')
    shotDict = getESPNShotDict(shots)
    return shotDict
def processESPNShotsPage(url):
    '''
    Handles grabbing the x,y coords from the ESPN shots page;
    returns a dict;
    '''
    shotSoup = soupFromUrl(url, parser='xml')['soup']
    shots = shotSoup.findAll('Shot')
    shotDict = getESPNShotDict(shots)
    return shotDict
Пример #5
0
def getESPNData(url, ptype):
    '''
    Handles which data is being called for; 
    '''
    soup = soupFromUrl(url, hdr=True)['soup']
    if ptype == 'box':
        labels = CONTENT_DICT[ptype]
        tables = soup.find_all('div', {labels[0]: labels[1]})
        data = getESPNbox(tables[0])
    elif ptype == 'pbp':
        labels = CONTENT_DICT[ptype]
        if 'Play-By-Play not available' in soup.text:  #nfid
            data = {'head': 'No PBP data for game', 'content': "!!!!!!"}
        else:
            tables = soup.find_all('div', {labels[0]: labels[1]})
            data = getESPNpbp(tables[1])  # check this plz
    elif ptype == 'extra':
        if raw:
            text = getText(raw)
        else:
            text = ''
        data = getESPNext(soup, EXTRA_LIST)
        data['text'] = text
    return data
def getESPNData(url, ptype):
    '''
    Handles which data is being called for; 
    '''
    soup    = soupFromUrl(url, hdr=True)['soup']
    if ptype=='box':
        labels  = CONTENT_DICT[ptype]
        tables  = soup.find_all('div', {labels[0]:labels[1]})
        data    = getESPNbox(tables[0])
    elif ptype=='pbp':
        labels  = CONTENT_DICT[ptype]
        if 'Play-By-Play not available' in soup.text:   #nfid
            data = {'head':'No PBP data for game', 'content':"!!!!!!"}
        else: 
            tables  = soup.find_all('div', {labels[0]:labels[1]})
            data    = getESPNpbp(tables[1])     # check this plz
    elif ptype=='extra':
        if raw:
            text = getText(raw)
        else:
            text = ''
        data    = getESPNext(soup, EXTRA_LIST)
        data['text'] = text
    return data