0

有没有办法使用 python 抓取喜欢帖子的用户名?我正在使用 InstaLoader,但遇到错误 "LoginRequiredException: --login required to access like a post" 。谁能帮我解决这个问题?

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

1 回答 1

0

您可以使用您的 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')
于 2021-03-21T15:41:01.513 回答