2016-08-02 75 views
2

有沒有辦法通過https://api.instagram.com/v1/users/search?q=jack&access_token=ACCESS-TOKEN限制我的查詢搜索以僅搜索公共帳戶?我正在構建一個Web應用程序,該應用程序允許我搜索Instagram用戶並跟蹤他們的用戶信息,但由於我無法訪問私人帳戶的信息,因此我不希望它們存在於查詢結果中(如果可能的話)。Instagram API僅搜索公共帳戶

我提交的應用程序Instagram的與範圍basicpublic_content,但不follower_list有權訪問target_user_is_private。我試圖找到一種方法,不必重新提交我的應用程序,但使用我必須檢查一個帳戶是公共還是私人。

歡迎任何建議hacky解決方案。

回答

0

您可以使用此API調用爲每個用戶:

https://api.instagram.com/v1/users/{user-id}/media/recent/?access_token=ACCESS-TOKEN 

如果該用戶是私人,你會得到這個錯誤響應:

{"meta": {"error_type": "APINotAllowedError", "code": 400, "error_message": "you cannot view this resource"}} 

如果其公衆,你會得到這樣的迴應這個:

{"meta": {"code": 200}, "data": {"username": "xxx", "bio": "xxx", "website": "", "profile_picture": "xxx", "full_name": "xxx", "counts": {"media": 22, "followed_by": 22, "follows": 22}, "id": "xxx"}}