Skip to content

0xnuminous/PGACHAMPIONSHIP

Repository files navigation

PGA Championship DraftKings# PGA Tour Stats Scraper

⚠️ Work in Progress: Not Fully Functional Yet!

This project is under active development. Player-level stat extraction and merging are not yet complete. CSV automation for all player stats is in progress. Please check back soon for a fully working version!

This project provides a robust, Playwright-based Python scraper for fetching all available betting markets and odds for the 2025 PGA Championship from DraftKings. It is designed for reliability with JavaScript-rendered content, automatic caching, and easy data export.

Features

  • Scrapes all main DraftKings betting markets for the PGA Championship (e.g. Tournament Winner, Top Finish, Winner Without, Double Chance, etc).
  • Accurately associates player names and odds for each market.
  • Automatic caching: Only fetches new data if the last scrape is over 1 minute old, reducing unnecessary site requests.
  • Exports data to JSON for easy downstream analysis.

Requirements

  • Python 3.8+
  • Playwright (pip install playwright)
  • pandas (pip install pandas)

Setup

  1. Install dependencies:

    pip install playwright pandas
    playwright install
  2. (Optional) If you are running for the first time, Playwright will prompt you to install browser binaries.

Usage

Run the scraper from the project directory:

python playwright_fetch_dk.py
  • If draftkings_odds_latest.json is less than 1 minute old, the script loads cached data.
  • If not, it scrapes fresh odds from DraftKings, saves them to JSON, and prints a preview.

Output

  • JSON file: draftkings_odds_latest.json containing a list of player/market/odds records.
  • Example structure:
    [
      {
        "Player": "Scottie Scheffler",
        "TOURNAMENT WINNER": "+425",
        "TOP FINISH (INC. TIES)": "+100",
        ...
      },
      ...
    ]

Notes

  • This script is designed for the 2025 PGA Championship but can be adapted for other golf events with minor URL changes.
  • For static HTML or other sportsbooks, you may need to implement a different scraping approach.

License

MIT License


About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages