Ejemplo n.º 1
0
def mybookie_nhl_extractor(page):
    tp = TableParser()
    tp.feed(page)
    tables = tp.get_tables()

    # Get rid of garbage lines in the table
    tables = tables[0][1:]

    # Find team names and moneylines
    pairs = []
    for i in range(len(tables)/2):
        name1 = tables[i*2][2].strip().split(" ")
        name1 = name1[0] if len(name1) == 1 else " ".join(name1[1:])

        name2 = tables[i*2+1][1].strip().split(" ")
        name2 = name2[0] if len(name2) == 1 else " ".join(name2[1:])

        moneyline1 = str(tables[i*2][-1]).strip()
        moneyline2 = str(tables[i*2+1][-1]).strip()

        if moneyline1 == '0' or moneyline2 == '0':
            continue

        pairs.append(((name1, moneyline1), (name2, moneyline2)))
    return pairs
Ejemplo n.º 2
0
def bodog_nhl_extractor(page):
    tp = TableParser()
    tp.feed(strip(page))
    tables = tp.get_tables()

    # Get rid of garbage rows
    rows = [r for t in tables for r in t if len(r) > 3][1:]

    # Find team names and moneylines
    pairs = []
    for i in range(len(rows)/2):
        name1 = rows[i*2][2].strip()
        name2 = rows[i*2+1][1].strip()
        moneyline1 = rows[i*2][4].strip()
        moneyline2 = rows[i*2+1][3].strip()
        pairs.append(((name1, moneyline1), (name2, moneyline2)))
    return pairs
Ejemplo n.º 3
0
def betdsi_nhl_extractor(page):
    tp = TableParser()
    tp.feed(strip(page))
    tables = tp.get_tables()

    # Get rid of garbage rows
    tables = [t for t in tables if len(t) == 2]

    # Find team names and moneylines
    pairs = []
    for table in tables:
        name1 = table[0][1].strip()
        name2 = table[1][0]
        moneyline1 = table[0][-1].strip()
        moneyline2 = table[1][-1].strip()
        pairs.append(((name1, moneyline1), (name2, moneyline2)))
    return pairs
Ejemplo n.º 4
0
def topbet_nhl_extractor(page):
    tp = TableParser()
    tp.feed(page)
    tables = tp.get_tables()

    # Get rid of garbage tables
    tables = [t for t in tables if len(t) == 3 and t[0][0] == t[0][1] == 0]

    # Find team names and moneylines
    pairs = []
    for table in tables:
        name1 = table[1][1].strip()
        name2 = table[2][1].strip()
        moneyline1 = table[1][5].strip()
        moneyline2 = table[2][5].strip()
        pairs.append(((name1, moneyline1), (name2, moneyline2)))
    return pairs
Ejemplo n.º 5
0
def betdsi_nhl_extractor(page):
    tp = TableParser()
    tp.feed(strip(page))
    tables = tp.get_tables()

    # Get rid of garbage rows
    tables = [t for t in tables if len(t) == 2]

    # Find team names and moneylines
    pairs = []
    for table in tables:
        name1 = table[0][1].strip()
        name2 = table[1][0]
        moneyline1 = table[0][-1].strip()
        moneyline2 = table[1][-1].strip()
        pairs.append(((name1, moneyline1), (name2, moneyline2)))
    return pairs
Ejemplo n.º 6
0
def sportsbetting_nhl_extractor(page):
    tp = TableParser()
    tp.feed(page)
    tables = tp.get_tables()

    # Clean up tables
    tables = tables[3][2:]
    tables = [r for r in tables if len(r) > 20]

    # Extract names/lines
    pairs = []
    for i in range(len(tables) / 2):
        name1 = tables[i * 2][2].strip()
        name2 = tables[i * 2 + 1][1].strip()
        moneyline1 = str(tables[i * 2][9]).strip()
        moneyline2 = str(tables[i * 2 + 1][8]).strip()
        pairs.append(((name1, moneyline1), (name2, moneyline2)))
    return pairs
Ejemplo n.º 7
0
def sportsbetting_nhl_extractor(page):
    tp = TableParser()
    tp.feed(page)
    tables = tp.get_tables()

    # Clean up tables
    tables = tables[3][2:]
    tables = [r for r in tables if len(r) > 20]

    # Extract names/lines
    pairs = []
    for i in range(len(tables)/2):
        name1 = tables[i*2][2].strip()
        name2 = tables[i*2+1][1].strip()
        moneyline1 = str(tables[i*2][9]).strip()
        moneyline2 = str(tables[i*2+1][8]).strip()
        pairs.append(((name1, moneyline1), (name2, moneyline2)))
    return pairs
Ejemplo n.º 8
0
def bovada_nhl_extractor(page):
    tp = TableParser()
    tp.feed(strip(page))
    tables = tp.get_tables()

    # Get rid of garbage lines in the table
    tables = tables[1:]
    for i, t in enumerate(tables):
        tables[i] = max(t, key=lambda x: len(x))

    # Find the team names and moneylines
    pairs = []
    for i in range(len(tables) / 2):
        name1 = tables[i * 2][2].strip()
        name2 = tables[i * 2 + 1][1].strip()
        moneyline1 = tables[i * 2][4].strip()
        moneyline2 = tables[i * 2 + 1][3].strip()
        pairs.append(((name1, moneyline1), (name2, moneyline2)))
    return pairs