Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/317.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用Scrapy或Instagram Python API访问Instagram中用户的所有追随者的用户名_Python_Json_Web Scraping_Instagram Api - Fatal编程技术网

使用Scrapy或Instagram Python API访问Instagram中用户的所有追随者的用户名

使用Scrapy或Instagram Python API访问Instagram中用户的所有追随者的用户名,python,json,web-scraping,instagram-api,Python,Json,Web Scraping,Instagram Api,如何在instagram中获取每个用户追随者的用户名?在json中,我只能访问追随者的数量。 以下是我正在使用的json处理URL: "https://www.instagram.com/buzzfeed/?__a=1" pprint(json_response["user"]["followed_by"]["count"]) 以下是pprintjson_响应[user]的开头 我可以看到u'follows_viewer':False,但这是公共帐户,我可以从其instagram帐户中看到bu

如何在instagram中获取每个用户追随者的用户名?在json中,我只能访问追随者的数量。 以下是我正在使用的json处理URL:

"https://www.instagram.com/buzzfeed/?__a=1"
pprint(json_response["user"]["followed_by"]["count"])
以下是pprintjson_响应[user]的开头

我可以看到u'follows_viewer':False,但这是公共帐户,我可以从其instagram帐户中看到buzzfeed的追随者。任何想法都被强烈建议

更新: 我使用Instagram API尝试了另一种方法,但一无所获,不确定出了什么问题:

print(api.user_followed_by(user_id=53112486))
([], None)
print(api.user_follows(user_id=53112486))
([], None)
我按照这个方法获取我的访问令牌,这是错的吗

https://api.instagram.com/oauth/authorize/?client_id=YOUR-CLIENT-ID&redirect_uri=YOUR-REDIRECT-URI&response_type=code&scope=basic+comments+follower_list+likes+relationships+public_content
我曾经http://localhost:8515/oauth_callback 对于我的重定向

它问我:

这是我授权的

也就是说,我可以获得我自己帐户的计数53112486是我的用户id:

info = api.user(user_id=53112486)
print(info.counts)
还有,当我试着

https://api.instagram.com/v1/users/self/followed-by?access_token=MINE
我得到了以下信息

{"pagination": {}, "meta": {"code": 200}, "data": []}
它们都返回[],无:


您无法再使用Instagram API获取其他用户的关注者,您只能获取经过身份验证的用户的关注者/以下列表。您需要让instagram审查和批准您的应用程序,并进入实时模式以访问API中的所有数据,同时您还需要获得关注者列表范围权限

问题第一部分的代码使用私有Instagram API,不支持获取追随者列表


简言之,您刚刚混淆了来自各地的代码,它甚至不相关,一个是公共api,另一个是私有api,您需要阅读文档https://api.instagram.com/v1/users/USERID/followed-by?access_token=ACCESSTOKENcount=-1. 关于instagram API的更多信息是,请查看帖子的最后几行,它甚至对self都不起作用:/@Monajalal你为什么要否决这个问题?@JonathanPortorreal谢谢Jonathan!我正在调查这件事!只是一个简单的问题,如果我上线,我是否仍然只能从我自己的追随者或任何公共用户的追随者那里捕获数据?
{"pagination": {}, "meta": {"code": 200}, "data": []}
 50         for page in api.user_followed_by( as_generator=True):
 51             print(str(page))
 52 
 53         print(api.user_follows(user_id=53112486))