Skip to content
Related Articles
Open in App
Not now

Related Articles

Instagram-explore module in Python

Improve Article
Save Article
  • Last Updated : 20 Aug, 2020
Improve Article
Save Article

instagram-explore module is an Instagram scrapping module.

Installation:

Run the following pip command :

pip install instagram-explore

This module has 8 functions currently for exploring Instagram:

  1. Getting user information
  2. Getting tag
  3. Getting user images
  4. Getting locations
  5. Location
  6. Location images
  7. Media
  8. Media images

Example 1 : To get information about a user we will use the user() method.

ie.user("username", max_id = None)

It will give html of page i.e. the homepage of the Instagram profile

Python3




# import the modules
import instagram_explore as ie
import json
  
# search user name
result = ie.user('timesofindia')
  
parsed_data= json.dumps(result, indent = 4,
                        sort_keys = True)
  
# displaying the data
print(parsed_data[15:400])

Output :

 “biography”: “The Times of India is India\u2019s most-read English newspaper and World\u2019s largest-selling English newspaper – A Times Internet Limited Product”,

       “blocked_by_viewer”: false,

       “business_category_name”: “Publishers”,

       “business_email”: “toisocialmedia@gmail.com”,

       “category_enum”: “BROADCASTING_MEDIA_PRODUCTION”,

       “connected_fb_p

Example 2 : Getting user images

If account is private – > Null is returned else links of images are returned sorted as latest.

Python3




# importing the modules
import instagram_explore as ie
import json
  
res = ie.user_images('timesofindia')
  
parsed_data = json.dumps(res, indent = 4,
                        sort_keys = True)
  
# displaying the data
print(parsed_data)

Output :

Here only one link is being displayed.

https://scontent-del1-1.cdninstagram.com/v/t51.2885-15/fr/e15/s1080x1080/117758575_167564261503193_2290116502716246854_n.jpg?_nc_ht=scontent-del1-1.cdninstagram.com&_nc_cat=105&_nc_ohc=4Yds4Fv58wUAX-4Pgra&oh=eaa3b5b243433239e134e427f340049c&oe=5F666630

Example 3 : Searching Tags 

By the tag() function, we will get information about the searched tag 

variable = ie.tag("Name_of_tag", max_id = None)

Python3




# importing the modules
import instagram_explore as ie
import json
  
# using the tag method
result = ie.tag('Binod')
  
parsed_data = json.dumps(result, indent = 4
                         sort_keys = True)
  
# displaying the data
print(parsed_data)

Output : 

Example 4 : Getting images by tag

Python3




# importing the modules
import instagram_explore as ie
import json
  
# Search user name
result = ie.tag_images('Binod')
  
parsed_data = json.dumps(result, indent = 4
                         sort_keys = True)
  
# displaying the data
print(parsed_data)

Output :

.


My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!