简体   繁体   English

instagram Web 使用 python 抓取

[英]instagram Web scraping using python

Is there any way to web scrape a usernames who like the post using python?.有什么方法可以让 web 使用 python 抓取喜欢帖子的用户名吗? I am using InstaLoader but Facing an error "LoginRequiredException: --login required to access likes of a post".我正在使用 InstaLoader,但遇到错误“LoginRequiredException: --login required to access like 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)

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 )您可以使用您的 instagram 帐户进行测试(您应该能够使用您的 instagram 帐户看到帖子意味着您无法看到私人 instagram 帐户的帖子

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')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM