我写的这段代码每10分钟给我1000个关注者,这对于获得1800万个关注者列表来说是一个缓慢的过程。我想访问普拉达的追随者名单在较短的数量时间到了。谢谢对于您的回复,这个缓慢的过程是instagram限制错误。所以给一个方法来更快地得到追随者列表。在
# 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())
主要瓶颈可能是从instagram中提取数据,但您可以通过在循环之外只打开和关闭一次来提高速度;而且您不需要阵列:
相关问题 更多 >
编程相关推荐