Instagram client.tag_recent_media 零个结果 #<Hashie::Array []>

Instagram client.tag_recent_media ZERO results #<Hashie::Array []>

Rails 带有 devise+omniauth+instagram 的应用程序

尝试搜索标签。

代码非常简单:

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 (as also described ) 的限制。

上面链接的开发者文档明确指出:

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 批准