The official Instagram API allows you to programmatically access your own comments and posts on Instagram. However, the Instagram API doesn’t allow you to get a list of posts made by other people, comments, and photos on the posts, or get a list of posts with a particular hashtag.
To extract that kind of information, you'll need to use our Instagram Scraper. The scraper is free to use and will let you download all of this public data from Instagram:
Scraping publicly available data is legal, but you need to be careful not to extract content that is protected by copyright or contains personal information. So, after scraping Instagram, double-check your output for data that would go against GDPR, CCPA, or could be considered intellectual property.
Just want to scrape Instagram posts, hashtags, profiles, or comments?
Use our ultra-fast and easy dedicated scrapers if you want to scrape specific Instagram data. These Instagram scrapers have fewer settings to change and they'll give you fast, clean results ⬇️
Just want to scrape Instagram profiles? Try Instagram Profile Scraper
Just enter one or more Instagram usernames or URLs and click to scrape.
Where to find the data
The easiest way to search and access content on Instagram is by using the mobile app or the website:
Just want to scrape Instagram posts? Try Instagram Post Scraper
Data available publicly without login
Our scrapers do not support logging into Instagram, so there are some limits on what you can and cannot scrape.
If you check the website in an incognito browser window, you’ll quickly find that there are some features that you can access freely and some that are either blocked or require you to log in. Here is what you can find without a login (Instagram keeps changing the rules, so some of this might have changed):
1. Search
You can search for profiles, hashtags, and places, and Instagram will return the top 100 posts.
The context query parameter serves as the filter and it can contain a location, user, or hashtag. The only limitation is that the endpoint returns just 100 results. If you need more, you need to enter a more detailed filter.
Want to scrape only Instagram hashtags? Try Instagram Hashtag Scraper
2. Posts from Profiles/Hashtags/Locations
When you open any public Instagram page that contains posts (e.g. profile, hashtag or location), Instagram will return an HTML page with the first few posts preloaded (probably using React server-side rendering). Then, when you scroll down the page, Instagram will continue loading more posts using an XHR request to Instagram’s GraphQL endpoint. The endpoint is protected with a token, so it’s not really possible to access it directly and we need to infinitely scroll the page. However, we can automate infinite scrolling nicely using headless Chrome with Puppeteer.
Posts visible on Instagram’s own profile page
Our tests haven’t found a limit to how many posts can be loaded using infinite scroll. There probably is one, but even up to a thousand posts were loaded during testing.
3. Comments on posts
Every Instagram post has publicly visible comments and shows a Load more comments button if there are more comments that can be shown.
Clicking on the button fires off an XHR request to Instagram’s GraphQL endpoint. Again, we can easily automate this using Puppeteer’s page.click()function and then extract the content of the comments from the web page.
Want to scrape only Instagram comments? Try Instagram Comments Scraper
Data available only after login
Unfortunately, certain content can be only accessed if you’re logged in using your Instagram account, for example:
List of followers
List of people a user follows
Although it would be possible to automatically log in to Instagram in order to access this data, this approach is risky since it can lead to the banning of your account by Instagram. Sure, you could create a fake Instagram account and use that instead, but that’s beyond the scope of this article and against Instagram terms and conditions. We don't recommend that you do this and none of our scrapers support it.
Over time, Instagram has been increasingly limiting the data you can access without login, so you’ll need to test to see what you can scrape without logging in.
Using an Apify actor to scrape the data
Our Instagram Scraper is one of many actors available in Apify Store. Apify actors are cloud programs that accept input, perform their job, and generate some output. They can be run manually in the app, using the API or scheduler.
The actor is written in Node.js and uses Apify SDK. On input, it takes an Instagram query or a list of direct profile URLs, then it searches the query and scrapes page details, posts, or comments from the results and direct URLs. All of the resulting data is stored in a structured form into a dataset, from which you can download it in formats such as JSON, XML, Excel, CSV, etc.
Before you get started scraping Instagram, note that we do not consider scraping vast amounts of personal data ethical and discourage anyone from doing so.
How to scrape Instagram with Instagram Scraper
So you want to use our Instagram Scraper to extract data from Instagram? This step-by-step guide should get you started in just a few minutes.
Step 1. Go to Apify Store for Instagram Scraper
When you are on the actor's page, click the Try for free button.
If you already have an Apify account, you will be redirected to Apify Console, which is your workspace to run tasks for your scrapers. If you don't have an Apify account, you can sign up using your email account, Google, or GitHub.
Step 2. Insert your search query or URLs in the Input field
Fill in the input fields, such as the Instagram URLs you want to scrape or what kind of data you want to extract.
You can add multiple URLs by clicking the +Add button.
Insert the maximum number of items you want to scrape in the Max items field.
Step 3. Run the scraper to collect your data
Once you are all set, click the Start button.
Notice that your task will change its status to Running, so wait for the scraper's run to finish. It will be just a minute before you see the status switch to Succeeded.
Step 4. Download your data
Move to the Dataset / Storage tab for the results of your scraping. This tab contains your data in lots of versatile formats: HTML table, JSON, CSV, Excel, XML, and RSS feed.
You can open them by clicking on View in another tab, Preview, or Download. You can then share the data, or upload it anywhere you like. Use it in spreadsheets, other programs or apps, or your own projects.
And that's all you need to get started scraping Instagram. If you run into any problems or need some advice, just join the conversation on our Discord server, where the Apify team and expert users regularly discuss solutions to tricky scraping problems.
If you need to scrape Instagram at scale or need an end-to-end service, you can request a custom solution.