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:
- Getting user information
- Getting tag
- Getting user images
- Getting locations
- Location
- Location images
- Media
- 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 :
.