Search code examples
instagraminstagram-api

Download images containing a specific tag with likes from Instagram


I would like to download images with a certain tag from Instagram with their likes. With this post I hope to get some advice or tips on how to do this. I have no experience with web scraping related stuff or web API usages. One of my questions is: can you create a program like this in python code or can you only do this using a webpage?

So far I have understood the following. To get images with a certain tag you have to:

  • need a valid access_token to even gain access to images by tag, which can be done like this. However, when I sign in you need to give a website. Does this indicate that you can only use the API's on websites rather than a python program for instance?
  • you use a media Tag Endpoint to search for tags by name.

I have no idea what the latest step will return exactly, but I expect that it will give me a specific image id that contains the tag. Correct? Now I will also need to get the likes belonging to these images. Just like latest step from before:

  • you use a likes Tag Endpoint to get a list of users that liked the image of which of course you can get the length.

If I can accomplish all of these steps it seems like I can achieve my original goal. I googled if there was something out there already. The only thing I could find was InstaRaider, but this did not seem to fit my description because it web scraped only the images from a specific user and not by tag or its likes. Any suggestions or ideas would be very helpful, I have only programmed in python and Java before..


Solution

  • I can only tell you that for URL you can use the localhost as this:

    http://127.0.0.1
    

    OR

    http://localhost
    

    I have also tried to do exactly the same before, but I could not, so I used a website to search for tags and images:

    http://iconosquare.com/search/[HASHTAG]