Instagram gem: getting photos with specific hashtags
instagram, ruby-on-rails
Solution
It can't be done directly. The Instagram API itself doesn't let you make a call like this- you have to either query a particular user's photos, or query a tag, and the gem provides no workaround.
So, first query the user:
@results = Instagram.user_recent_media(1907035, {access_token: t.token, count: 60}) # 60 appears to be the max
Then keep the photos with the tags you want. In the results, each element has a "tags" array. For example `@results.first["tags"]` returns the array of tags for the first photo.
Here's the well-documented code for making typical queries:
https://github.com/Instagram/instagram-ruby-gem/blob/master/lib/instagram/client/users.rb
Problem
Is it possible to select only pictures with certain hashtags from a user using the instagram gem? Couldn't find hashtag select in the docs. If so, please provide an example.