Instagram is the worst image-sharing social media website the world has ever seen. Anyone who has ever posted on there should commit suicide.
Why is it such garbage?
- Images are limited to 1080x1080 (1350px in height for portrait images)
- The API fucking sucks
- It's one of the hardest websites to get data from.
The API
The API is severely limited. Most platforms have API endpoints for developers that let you search through posts, hashtags, or an user's profile, like Twitter does. Here, it's an entirely different story, and the API restrictions they put on us developers are sincerely kind of funny:
So.. How can I scrape shit?
There are methods available, but they all have caveats. First, you need to understand that Instagram blocks all non-residential IPs, and even then, it only lets you view a very small threshold of posts/profiles before it blocks you. When scraping the main endpoints (like instagram.com/profile), it's advisable to be logged in.
Instagram frontends
Bibliogram used to be a frontend for Instagram, but even when it was maintained it always was regarded as a piece of shit. It would only let you see a limited amount of posts, and every user had a really small ratelimit. It was an all-around shitty experience. Personally, I'm glad it died off.
On the other hand, you've got frontends like https://imginn.com/ and https://www.pixnoy.com. They work, and they support searching profiles. They're all behind Cloudflare though, so it might be harder to scrape shit from those places. Besides, you shouldn't really scrape anything from these shitholes as they can be quite unreliable themselves. If you search up "instagram view profile no login" or "instagram story viewer", you'll be able to find a plethora of other sites that let you hit up the site, although most of them won't support searching for profiles.
gallery-dl
Gallery-DL lets you scrape IG posts. To bypass the initial page view threshold, you can supply cookies to your gallery-dl process.
To do this, log onto a (burner) Instagram account in a private window. From here, use a Firefox extension like ExportCookies or any other extension that lets you export cookies as a text file. Then, run the following command:
gallery-dl <url> --cookies <cookie file>
It should then create a folder hierarchy of all images it can find.