ruby-on-rails - Instagram client.tag_recent_media 零结果 #<Hashie::Array []>

标签 ruby-on-rails ruby instagram instagram-api

带有 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/

相关文章:

ruby-on-rails - 试图将项目上传到 Heroku,Heroku 说我的 binstubs 被破坏了

javascript - 无法解析从 Instagram API 返回的 user_media 对象

real-time - 理解 min_tag_id 和 max_tag_id

ruby-on-rails - Controller 编辑方法,提交前修改对象数据

ruby-on-rails - 使用 Matthuhiggins foreign_key 删除外键?

ruby-on-rails - Ruby on Rails - 将变量传递给部分中的部分

jquery - 我这里有 OpenLayers/jQuery 冲突吗?

ruby - 1.8 与 1.9 中的 BigDecimal

ruby - Windows Visual Studio 中的 Iron Ruby

javascript - Instagram 上的图片已经停止传播