It webscrapes data from instagram.
This is python program that automates data collection by web-scraping from Instagram by logging in and generating csv files and making plots by analysing data.
This program needs to be updated as there is update in site of Instagram.
You should have google chrome installed on system. Do not switch tab while running the program. The windows will automatically close once operations are completed.
Basic work flow of program
- searches a keyword in instagram(example - "gaming")
- extract username from search result
- visits each username
- extracts number of followers, last 10 post, their captions, likes and date of upload
- prepare csv and generates plot.
It generates the following results:
- Generate first csv with following columns : [username, number of followers, likes on first 10 posts, captions on each of the post, number of post done in 3 days, avg likes on last 10 post, avg likes to followers ratio].
- Generate 2nd csv with frequency of words used in all captions(stopwords have been removed).
- Generate 3rd csv with hashtags used in all captions from all usernames.
- Generates plots for
- Top 5 usernames by number of followers
- Number of post done in last 3 days
- Avg likes on last 10 post
- Avg likes to followers Ratio
- Pie chart 5 most used hashtags
Libraries used
- pandas
- numpy
- matplotlib
- seaborn
- nltk
- selenium
- datetime
- re
- time 10.operator 11.collections
If you encounter any error while running the program, rerun it.