A simple Selenium based IG Scraper
work in progress - use at your own peril
Requires
- Python 3.x
- Selenium
- Chrome
- Chromedriver (compatible chromedriver)
- Standard Python libraries: urllib, bs4, json, re, time
Information on setting up selenium with Chrome: https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver
Functionality:
log_in()
- logs you in using credentials from class instantiation. Note if 2-factor authentication is enabled, you will need to input the 2nd authentication code.get_user(username)
- Navigate to user pagescroll_page(sleep=2, maxiters=1000, reset_links=True)
- Scroll through user page and collect user image linksget_all_photos(sleep=2, fpath='../Data/)
- downloads all photos from links in self.piclinks_profile.
Auxiliary methods:
reset_links()
- clears photo queueget_page(url)
- same as selenium "get"quit()
- shuts down selenium drivers and resets linksget_photos(fpath='../Data/)
- downloads current photo to fpath