/fanduel-scraper

Uses RSelenium to iterate over and screen scrape Fanduel game results into a dataframe

Primary LanguageR

READ FIRST

KLUDGES

  1. Viewport - Currently RSelenium does not include a function to adjust viewport size. As such, if you are running a smaller browser window you will need to manually decrease (cmd-) the content size in the viewport to 50% or so. Do this when the window opens. Or use NoSquint Plus plugin with a Firefox user account.
  2. Versions - Requires Firefox 47.0.1+ or <= 45.x.x. Includes Selenium Server JAR 2.53.1
  3. Slow - Currently very slow, ~ 10 minute build time for the 1152obs x 10vars example dataframe

PREPARATION

  1. CHROME WEBDRIVER (None required for Firefox) Included version 2.22 https://sites.google.com/a/chromium.org/chromedriver/downloads
  2. SELENIUM SERVER JAR
    Included version 2.53.1 Make sure to be running a 64-bit version of Java http://www.seleniumhq.org/download/
  3. COMMAND FILE
    Included executes from within the batch.command directory. The batch.command script is accessed from R. Note that permissions may have to be adjusted to run the script from R. Note the batch-ff command executes for Firefox.

RUNNING THE R SCRIPT

  1. Prep and run batch.command to launch selenium standalone server. Sys.sleep ensures the server gets running before R tries to open the remote driver.
  2. Create the browser object using a remote driver
  3. Opens a chrome browser and navigates to page
  4. Logs in to Fanduel
  5. Navigates to example game URL
  6. Iterates over user teams
  7. Iterates over pages
  8. Saves teams as a DF by UN
  9. Shuts down Selenium