Scrape Instagram using Instagramy in Python
Last Updated :
17 May, 2022
In this article, we will learn how can we get Instagram profile details using web scraping. Python provides powerful tools for web scraping, we will be using Instagramy here. This tool is specifically made for Instagram and also analyzes the data using Pandas.
Installation
The python package Instagramy is used to scrape Instagram quick and easily. This package is installed by running the following command. Based on the network connection it scrapes the data for you.
pip install instagramy
Example 1: Scraping basic details
Python3
from instagramy import InstagramUser
user = InstagramUser( "geeks_for_geeks" )
print (user.is_verified())
print (user.popularity())
print (user.get_biography())
posts = user.get_posts_details()
print ( '\n\nLikes' , 'Comments' )
for post in posts:
likes = post[ "likes" ]
comments = post[ "comment" ]
print (likes,comments)
|
Output:
Example 2: Analysing the data
Python3
from instagramy import Instalysis
teams = [ "chennaiipl" , "mumbaiindians" ,
"royalchallengersbangalore" , "kkriders" ,
"delhicapitals" , "sunrisershyd" ,
"kxipofficial" ]
data = Instalysis(teams)
data_frame = data.analysis()
data_frame
|
Output:
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...