Sorting instagram posts by likes


Hi!

This post is about a semi-automatic method to sort posts of an Instagram user by likes. Why you use this method is totally your concern, I take no responsibilities. I am in no way related to Instagram themselves. Another thing is web APIs for a service like Instagram keep changing with time. The scripts used or the method may not work after some time but as of writing this article it is working.

Having said that I hope it is of value to some value of you.

Requirement

I will be using Mozilla Firefox for this blog post(which is also my recommendation). But you should be able to find all features I use here (console, saving, filtering etc) in all modern browsers.

Steps

Instagram web page

Please note if it is a private account that you do not follow, you won’t be able to see their posts and also not able to sort them in any way.

Clear logs option

Filter by xhr

Modify the interval based on your internet speed(lower for faster internet)

Modify the iter based on number of posts in that account(higher for higher posts). On average a successful request fetches about 12 items, so a good starting number for iter is approximately(number_of_posts/12)

Console script running

Saving har file

Running the script

If you want top 100 posts you can just change the number :

   python sorter.py downloaded.har 100

#script  #instagram  #tech-hacks 

Share this: