Beispiel #1
0
def get_pucklines():
    url = 'https://classic.sportsbookreview.com/betting-odds/nhl-hockey/pointspread/'
    game_days = get_games(url)

    puck_lines = []

    for game_day in game_days:
        game_date = get_game_date(game_day)
        if game_date:
            games = game_day.find_all(
                'div', attrs={'class': 'event-holder holder-scheduled'})

            for game in games:
                teams = get_game_info(game)
                game_info = f'{teams} {game_date}'
                lines = gs.run_lines(game)
                if lines[0]:
                    # check that lines aren't empty
                    line = {
                        'game': game_info,
                        'away_odds': lines[0],
                        'home_odds': lines[1]
                    }
                    puck_lines.append(line)

    return puck_lines
Beispiel #2
0
def get_spreads(url, sport):
    game_days = get_games(url, sport)

    spreads = []

    for game_day in game_days:
        game_date = get_game_date(game_day)
        if game_date:
            games = game_day.find_all(
                'div', attrs={'class': 'event-holder holder-scheduled'})

            for game in games:
                teams = get_game_info(game)
                game_info = f'{teams} {game_date}'
                if 'basketball' in sport:
                    lines = gs.spreads(game)
                else:
                    # baseball and hockey
                    lines = gs.run_lines(game)
                if lines[0]:
                    # check that lines aren't empty
                    line = {
                        'game': game_info,
                        'away_odds': lines[0],
                        'home_odds': lines[1]
                    }
                    spreads.append(line)
    return spreads