Here, I’m sharing how you can automatically download contest data from Draft Kings.
How to do it
Draft Kings protects it’s content behind a login-wall so we have to:
- create a program that logs into draft kings
- click the appropriate links to get to the contests.
Without further ado, here is the code. We use Selenium to automate our chrome browser and we store our login credentials in a config.py file (create your own).
- Open Chrome
- Sign In
- Open NFL Live Contests
- Extract contest ids and information
- Download contest data
That’s it! For the NFL, I’d recommend you run this every Sunday around 9:30 EST since all the lineups will be published for the major Sunday only contests.
The US has taken the position that scraping public data is fine so long as you don’t scrape at a disruptive rate. That being said, Draft Kings data is a gray area. They encourage you to download it and don’t really restrict the use but say you can’t use automated scrapers in their terms of service.
Personally, I find this ridiculous because Draft Kings seems to intentionally make their contest csv a pain to parse for your basic excel user by using some wonky space delimited format for their players. Even worse, DFS operators provide their contest info to sites like SuperLobby but not to the average player. And if these DFS operators want to continue using the argument that DFS is a game of skill they need to demonstrate that they make it easy for people, not sharks, to use the data.
If I were you, I’d make my scraping look as human as possible so they can’t prove you scraped to get it. I have a basic example on how to do that here.
During the regular season, I’ll be publishing weekly recaps that use market basket analysis to understand ownership and stacks beyond basic ownership percentages.