Scrape Player’s data from ESPN using Python and Selenium
In this post, we’ll see how we can use Selenium with Python to scrape data from espn.
Note: Code given here is based on Python3.
Step1 : Get code given at https://raw.githubusercontent.com/vinycoolguy2015/awslambda/master/espn_scrapper.py
Step2: Install selenium package using pip3 install selenium command.
Step3: Install chrome driver. I am using a Mac and used brew cask install chromedriver command to install chrome driver. If you are using Windows, you can follow http://jonathansoma.com/lede/foundations-2018/classes/selenium/selenium-windows-install/ for installation.
Step4: In the code, change path for chrome driver(In my case it’s /usr/local/bin/chromedriver).I’ve set it as
self.driver=webdriver.Chrome(‘/usr/local/bin/chromedriver’)
That’s all. Now execute the code using python3 espn_scrapper.py command.
Now we’ve got our data which you can format as per your requirement.