This script scrapes handle and name from top posts on Instagram based on #hashtags using selenium webdriver
- Logs in
- Find instagram top posts by provided #hashtag
- Navigate to each
@handleand saves@handle,namein a file
- Python 3.x+
pip
pip install -r requirements.txt- Download chromedriver. Place in root directory.
- Create
influencersandtagsfile (no extension) in root directory - Set
IG_USERNAMEandIG_PASSWORDenvironment variables $ python app.py
tags file should look like:
gaming
mensfashion
Results will be stored in influencers file. E.g.
pewdiepie,PewDiePie
markiplier,Markiplier
MAX_HANDLE_ATTEMPTSset to25by default. Sets the number of posts the script will scrape in a single run.MINIMUM_FOLLOWER_COUNTset to10000by default. Sets the minimum number of followers for influencer to be recorded.
- Duplicate
@handles will not be saved toinfluencersfile
- Emojis/special characters in names are ignored when saving to
influencers - Commas in names are replaced as a space