user3400019
user3400019

Reputation: 1

Instagram: sort photos with a specific tag with most likes

I'm running a contest on the web where the image with the most likes wins. It's tiresom having to go through 900 images manually so what I want to do is, sort all images with the tag lets say #computer after the amount of likes, with the most liked pics on top. I have searched the net like crazy for some program or site that does this (ExtraGram, gramhoot, statigram, webstagram) but none offer to sort by amount of likes and it drives me INSANE! It's a really relevant request.

I've tried istafeed.js but it doesn't include all images, actually it leaves out the ones with the moest likes which defies the purpose.

Upvotes: 0

Views: 6419

Answers (2)

user3325400
user3325400

Reputation: 29

The best way to achieve this is to pull the photos in and then sort them programmatically based on the likes numeric value. I've designed a plugin that does this automatically for you for anyone interested.

Instagram Journal

Upvotes: 0

therewillbesnacks
therewillbesnacks

Reputation: 1015

There's nothing I know of in the Instagram API that sends back media sorted by likes in advance. I don't think there's a tool to do this either, but writing one is relatively simple IMO and I've done it before for a contest specifically.

The simplest thing to do is to do the following:

  1. Use the Instagram API (via a library or pure REST) to query by tag. For instance, if you only care about the most recently tagged media or you want to process by date, you can use the [/tag/tag-name/media/recent][1] enpoint.

  2. Page through each result page by processing the next_max_id/next_max_tag_id.

  3. Collect the results locally into a database. You will receive the "like" count for each media item. You will have to update the data if you want to track the likes over time.

  4. Sort the results using your database or if it's a small result set, you could skip #3 and just sort in memory.

  5. If you need to refresh the results, you need to subscribe to the Tag via the API. You can give Instagram a URL to then push updates, and then you'll have to retrieve 1 or media items and update them in your database accordingly.

You will of course need to register your application with Instagram to get an API key if you want to do this. Then you can either send them your client_id or use OAuth.

Upvotes: 3

Related Questions