2

Rails app with devise+omniauth+instagram

Try to search for tags.

The code is pretty straightforward:

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 []>

Although the tag search tells me there is 139391443 medias with the tag "cat", I get zero result when looking for them.

Is the tag search only search in my user's profile ? or user feed ?

I wanna do a full public tag search like in twitter.

gdurelle
  • 2,079
  • 22
  • 38

1 Answers1

4

It looks as if you are running into a restriction of the Instagram API's Sandbox Mode (as also described here).

The above linked developer documentation states specifically:

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.

Have a look at how to get your app approved by Instagram here.

Alexander Presber
  • 6,429
  • 2
  • 37
  • 66