Python 3 Instagramy Library Script to Scrape Instagram API Posts Details Images and Profile of Person in Command Line Full Project For Beginners

Python 3 Instagramy Library Script to Scrape Instagram API Posts Details Images and Profile of Person in Command Line Full Project For Beginners

 

Welcome folks today in this post we will be scraping instagram posts and images without instagram api in python using instagramy library. All the full source code of the application is shown below.

 

 

Get Started

 

 

In order to get started you need to install the following library using the pip command as shown below

 

pip install instagramy

 

After installing this library make an app.py file and copy paste the following code

 

Instagram User Details

 

First of all we will get the instagram user details in this python script

 

app.py

 

from instagramy import InstagramUser 

session_id = "38566737751%3Ah7JpgePGAoLxJe%334"


# Connecting the profile 
user = InstagramUser('google', sessionid=session_id)

# printing the basic details like 
# followers, following, bio 
print(user.is_verified)
print(user.biography)

 

 

Now if you execute the python script by typing the below command

 

python app.py`

 

Now if you execute this script it will tell you the biography and verified status of the user as shown below

See also  Python 3 PyQt5 Popup Message or Alert Boxes With Icons Using QMessageBox Class Widget GUI Desktop App Full Project For Beginners

 

 

 

Instagram HashTags Details

 

 

Now we will be writing the python script to scrape instagram hashtag details

 

app.py

 

from instagramy import InstagramHashTag

session_id = "38566737751%3Ah7JpgePGAoLxJe%334"


# Connecting the profile 
posts = InstagramHashTag('coding', sessionid=session_id)

print(posts.number_of_posts)

 

 

It will tell you the number of posts related to this hashtag

 

 

 

Instagram Posts Details

 

 

Now we will be scraping the details of the instagram post such as the author of post and likes of post and also some more details about the post such as images and videos

 

from instagramy import InstagramPost

session_id = "38566737751%3Ah7JpgePGAoLxJe%334"

post = InstagramPost('CLGkNCoJkcM', sessionid=session_id)

print(post.author)

print(post.number_of_likes)

print(post.post_data) # More data about post as dict

 

 

 

Leave a Reply