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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With