带有 devise+omniauth+instagram 的 Rails 应用
尝试搜索标签。
代码非常简单:
Instagram.configure do |config|
config.client_id = Rails.application.secrets.instagram[:key_id]
config.client_secret = Rails.application.secrets.instagram[:secret]
end
client = Instagram.client(access_token: "myaccesstoken")
client.tag("cat")
=> #<Hashie::Mash media_count=139391443 name="cat">
client.tag_recent_media("cat", count: 10)
=> #<Hashie::Array []>
虽然标签搜索告诉我有 139391443 个带有标签“cat”的媒体,但在查找它们时我得到的结果为零。
标签搜索仅在我的用户个人资料中搜索吗?或用户提要?
我想像 Twitter 一样进行完整的公共(public)标签搜索。
最佳答案
您似乎遇到了 Instagram API Sandbox Mode 的限制(也如here所述)。
上面链接的开发者文档具体说明了:
As another example, let's consider an endpoint that returns a list of media:
/tags/{tag-name}/media/recent
. The response returned by this endpoint will contain only media with the given tag, as expected. But instead of returning media from any public Instagram user, it will return only media that belongs to your sandbox users, restricted to the last 20 for each user.
了解如何让您的应用获得 Instagram 批准 here .
关于ruby-on-rails - Instagram client.tag_recent_media 零结果 #<Hashie::Array []>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49326208/