小编Gab*_*ita的帖子

使用 python 脚本获取 Instagram 粉丝列表

我是 Python 编程的初学者,我想将我的 Instagram 粉丝和关注列表导出到一个 excel 文件中。在谷歌上搜索我找到了这篇文章。我将粘贴以下代码:

# Get instance
import instaloader
L = instaloader.Instaloader()

# Login or load session
L.login(username, password)        # (login)


# Obtain profile metadata
profile = instaloader.Profile.from_username(L.context, "prada")

# Print list of followees
follow_list = []
count=0
for followee in profile.get_followers():
    follow_list.append(followee.username)
    file = open("prada_followers.txt","a+")
    file.write(follow_list[count])
    file.write("\n")
    file.close()
    print(follow_list[count])
    count=count+1
# (likewise with profile.get_followers())
Run Code Online (Sandbox Code Playgroud)

我编辑的只是“登录或加载会话”部分中的用户名和密码以及“获取配置文件元数据”部分中的“prada”。所以我的代码看起来像这样:

# Login or load session
L.login("myusername", "mypassword")        # (login)


# Obtain profile metadata
profile = instaloader.Profile.from_username(L.context, "myusername")
Run Code Online (Sandbox Code Playgroud)

虽然我重置了密码,但仍然出现以下错误:

Traceback …
Run Code Online (Sandbox Code Playgroud)

python python-3.x instagram

7
推荐指数
1
解决办法
6941
查看次数

标签 统计

instagram ×1

python ×1

python-3.x ×1