Skip to main content

A web scraper that collects historical MLB and MLS soccer betting odds from SportsBookReview

Project description

SBR Odds Scraper

A web scraper that collects historical MLB and MLS soccer betting odds from SportsBookReview.

Based on Arnav Saraogi's mlb-odds-scraper.

Installation

pip install sbr-odds-scraper

Python API

import sbr_odds_scraper as sbr

# Single day - returns pandas DataFrame
df = sbr.scrape("2024-10-01")

# Date range
df = sbr.scrape("2024-10-01", "2024-10-05")

# Specific odds types (moneyline, pointspread, totals)
df = sbr.scrape("2024-10-01", odds_types=["moneyline"])

# Specific sportsbooks
df = sbr.scrape("2024-10-01", sportsbooks=["fanduel", "draftkings"])

# MLS soccer odds
df = sbr.scrape("2024-10-02", sport="soccer")

# Combine filters
df = sbr.scrape("2024-10-01", odds_types=["moneyline"], sportsbooks=["fanduel"])

# Faster scraping (may trigger rate limits)
df = sbr.scrape("2024-10-01", fast=True)

# Raw dict instead of DataFrame
data = sbr.scrape_raw("2024-10-01")

DataFrame Columns

Column Description
date Game date
start_time Game start time (ISO format)
away_team, home_team Team full names
away_score, home_score Final scores
venue Stadium name
game_type R=Regular, F=Wild Card, D=Division, L=League, W=World Series
sportsbook Sportsbook name (fanduel, draftkings, betmgm, etc.)
odds_type moneyline, pointspread, or totals
opening_*, current_* Opening and current line values

CLI Usage

sbr-odds-scraper 2024-10-01 2024-10-05 -t moneyline pointspread -o odds.json
sbr-odds-scraper 2024-10-02 2024-10-02 --sport soccer -t moneyline
Flag Description
-t, --types Odds types: moneyline, pointspread, totals (default: moneyline)
-s, --sport Sport: mlb or soccer (default: mlb; soccer scrapes MLS odds)
-c, --concurrent Concurrent requests (default: 5)
-f, --fast Faster scraping (reduced delays)
-o, --output Output filename (default: mlb_odds.json)

JSON Structure

The raw data is organized by date. Each date contains a list of games with sportsbook odds:

{
  "2021-04-01": [
    {
      "gameView": {
        "startDate": "2021-04-01T17:05:00+00:00",
        "awayTeam": {
          "fullName": "Toronto Blue Jays",
          "shortName": "TOR"
        },
        "awayTeamScore": 3,
        "homeTeam": {
          "fullName": "New York Yankees",
          "shortName": "NYY"
        },
        "homeTeamScore": 2,
        "gameStatusText": "Final (10)",
        "venueName": "Yankee Stadium",
        "gameType": "R"
      },
      "odds": {
        "moneyline": [
          {
            "sportsbook": "fanduel",
            "openingLine": { "homeOdds": -188, "awayOdds": 155 },
            "currentLine": { "homeOdds": -200, "awayOdds": 168 }
          },
          {
            "sportsbook": "draftkings",
            "openingLine": { "homeOdds": -175, "awayOdds": 148 },
            "currentLine": { "homeOdds": -195, "awayOdds": 165 }
          }
        ],
        "pointspread": [
          {
            "sportsbook": "fanduel",
            "openingLine": { "homeOdds": 122, "awayOdds": -144, "homeSpread": -1.5, "awaySpread": 1.5 },
            "currentLine": { "homeOdds": 100, "awayOdds": -120, "homeSpread": -1.5, "awaySpread": 1.5 }
          }
        ],
        "totals": [
          {
            "sportsbook": "fanduel",
            "openingLine": { "overOdds": -106, "underOdds": -114, "total": 8 },
            "currentLine": { "overOdds": -122, "underOdds": 100, "total": 7.5 }
          }
        ]
      }
    }
  ]
}

Notes

  • Historical data available from ~2019-05-03 onwards
  • Use fast=True / -f sparingly to avoid rate limiting
  • Game types: R=Regular, S=Spring, E=Exhibition, A=All-Star, D=Division, F=Wild Card, L=League Championship, W=World Series

Credits

Original scraper by Arnav Saraogi.

Disclaimer

For educational purposes only. Review SportsBookReview's Terms of Service before use.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sbr_odds_scraper-0.1.6.tar.gz (13.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sbr_odds_scraper-0.1.6-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

Details for the file sbr_odds_scraper-0.1.6.tar.gz.

File metadata

  • Download URL: sbr_odds_scraper-0.1.6.tar.gz
  • Upload date:
  • Size: 13.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.9

File hashes

Hashes for sbr_odds_scraper-0.1.6.tar.gz
Algorithm Hash digest
SHA256 ca1ad7b67c3de067aecdc0bb738c816bd54f93a296e3def2c6e5e7c81958eaae
MD5 40c76f3b60d1439b0dd4488f84749896
BLAKE2b-256 b5bd63c93ac38e646614c4202ae41358fdbf8f59e14745cadd04026a85302d70

See more details on using hashes here.

File details

Details for the file sbr_odds_scraper-0.1.6-py3-none-any.whl.

File metadata

File hashes

Hashes for sbr_odds_scraper-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 b5dde747fd6136b1afd04a18f5d10e2e2098dfac250038c75997d5b69e637012
MD5 09a9c93b9bacae36805f550a1d8c6fe8
BLAKE2b-256 6e3d1111002926e9c46b0ed236db6acc5372a9a1b033c9d678e3a389fe347dd4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page