instagram Web scraping using python

882 Views Asked by At

Is there any way to web scrape a usernames who like the post using python?. I am using InstaLoader but Facing an error "LoginRequiredException: --login required to access likes of a post" . Can anyone help me out in this?

import instaloader 
L = instaloader.Instaloader() 
Post = instaloader.Post.from_shortcode(L.context, 'CKplgftjVW_') 
for like in Post.get_likes(): 
    print(like.username)
1

There are 1 best solutions below

0
On

you can use your instagram account to test (you should be able to see the post using your instagram account means you cannot see a private instagram account's posts)

import instaloader 
L = instaloader.Instaloader() 
user = 'your_instagram_username'
password = 'your_instagram_password'

try:
    L.login(user,password)
   
    Post = instaloader.Post.from_shortcode(L.context, 'CKplgftjVW_') 
    for like in Post.get_likes(): 
         print(like.username)
except:
    print('Somthing went wrong')