如何在instagram中获取用户的每个追随者的用户名?在json中,我只能访问关注者的数量。 这里是JSON处理的URL我使用:在Instagram中使用Scrapy或Instagram访问用户的所有追随者的用户名Python API
"https://www.instagram.com/buzzfeed/?__a=1"
pprint(json_response["user"]["followed_by"]["count"])
这里是pprint(json_response["user"])
{u'biography': u"Hi, we're:q
BuzzFeed dot com the website. Download our app:",
u'blocked_by_viewer': False,
u'connected_fb_page': None,
u'country_block': False,
u'external_url': u'http://bzfd.it/2cpjV5B',
u'external_url_linkshimmed': u'http://l.instagram.com/?e=ATN_0_BAWjtGnChrZAtmnHUKqbPDjr3JcppPl3dQc7xbokFd56UvRHua36v9XsY&u=http%3A%2F%2Fbzfd.it%2F2cpjV5B',
u'followed_by': {u'count': 2527289},
u'followed_by_viewer': False,
u'follows': {u'count': 127},
u'follows_viewer': False,
u'full_name': u'BuzzFeed',
u'has_blocked_viewer': False,
u'has_requested_viewer': False,
u'id': u'1538653985',
u'is_private': False,
u'is_verified': True,
u'media': {u'count': 2175,
u'nodes': [{u'__typename': u'GraphVideo',
u'caption': u'me when I finally get paid',
u'code': u'BRJs_2Zj143',
u'comments': {u'count': 1330},
u'comments_disabled': False,
u'date': 1488491778,
u'dimensions': {u'height': 640, u'width': 640},
开始我可以看到,u'follows_viewer': False
但这是公共帐户,我可以看到BuzzFeed使用的追随者它的instagram帐户。任何想法都被强烈建议。
更新: 我试图通过使用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
我REDIRECT_URI
其中我的授权!
这就是说,我可以让我自己的帐户数(53112486是我的user_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": []}
这些都返回([], None)
:
50 for page in api.user_followed_by(as_generator=True):
51 print(str(page))
52
53 print(api.user_follows(user_id=53112486))
貌似端点得到用户的追随者是这样的:'https://api.instagram.com/v1/users/USERID/followed-by?access_token = ACCESSTOKENcount = -1'。有关Instagram API的更多信息,请参阅https://www.instagram.com/developer/endpoints/relationships/ – eLRuLL
请检查帖子的最后几行,它甚至没有为自己工作:/ –
http ://stackoverflow.com/questions/41286489/instagram-api-not-returning-followers @MonaJalal –