如何在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 –