Black-Friday Black-Friday
logo

Instagram API Scraper - Social Media Data Collection from Instagram

RealdataAPI / instagram-api-scraper

Extract and download Instagram profiles, hashtags, photos, places, and posts without login using Instagram API Scraper. Save your data as an RSS feed, HTML table, Excel sheet, XML file, or any other form. Supports URL lists and search keywords. Our Instagram data collection tool is available in the USA, UK, UAE, Spain, Canada, Australia, Japan, Germany, France, Mexico, Singapore, and other countries.

What is Instagram API Scraper and How Does it Work?

To set up an Instagram scraping tool for searching hashtags, profiles, and places on Instagram, use Instagram API Scraper. Optionally, you can add URLs of specific Instagram fields that you want to scrape and collect comments, page details, posts, hashtags, profiles, locations, etc.

You can collect the following data using Instagram Data Scraper.

User Profiles

  • Using https://www.instagram.com/[PROFILE] as a sample URL, you can scrape Instagram profiles with the latest posts if there are no results in the input.

Posts

  • Scrape the top Instagram post comments by direct links for frequent posts, with https://www.instagram.com/p/[SHORTCODE] being the sample URL.
  • Reels using locations, hashtags, regular posts, profiles, etc. With the sample URL https://www.instagram.com/reel/[SHORTCODE].
  • Or IGTV videos using https://www.instagram.com/tv/[SHORTCODE] as a sample URL.

Instagram Post Comments

  • You can Scrape Instagram comments from selected posts using the post URL as the input.

Locations and Tags

  • Scrape the selected tag from Instagram using this sample URL - (https://www.instagram.com/explore/tags/apify/)
  • Scrape a location list using https://www.instagram.com/explore/locations/c530281/prague-czech-republic/ as an example URL.
  • Scrape exact Locations of selected places with https://www.instagram.com/explore/locations/110589025635590/prague-czech-republic/ as a direct sample URL.

Text Search

  • You can ask the scraper to collect search keywords to find locations, profiles, and hashtags from Instagram.

Why use Instagram API Scraper to Scrape Instagram?

You can get valuable data using API data extraction from Instagram by the social media scraper about users, hashtags, locations, comments, posts, and more. It will help you to monitor brand awareness, forecast trends, and learn ways to improve performance on the leading social media platform. You can also monitor your competing influencers to study their marketing strategies and find ways to collaborate with targeted influencers.

If you need more ways, visit our Industry pages about marketing and media data scraping that many companies use to collect required data.

How to Scrape Instagram for Social Media Data Collection Using Instagram API Scraper?

We've developed the Instagram Scraper Extension for simple and quick applications with few parameters and settings. Only follow the simple steps that we have mentioned below.

  • Please create an account on our platform with the necessary credentials and log in to your account.
  • Open the Instagram API Crawler.
  • Add multiple search queries or links to extract data.
  • Click the Save and Start button and allow some time for the Instagram Data Extractor to help you with the required data.
  • Save and download the collected data in XML, Excel, HTML, JSON, or any other format.

How Many Results Can You Scrape With an Instagram API Scraper?

Depending on your data requirement, the Instagram API Crawler gives variable output. You can visit the URL of the required data in the incognito mode of the browser to get an idea and check what content the Instagram platform displays to users who haven't logged in to the platform.

It would help if you remembered that Instagram data scraping is dynamic. The tool's output varies depending on location, input complexity, and other factors.

Hence, we constantly execute the scraper tests to maintain the quality benchmark of the tool. To understand better and get the experience, you must perform a trial run of the Instagram data scraping tool.

What is the Cost of Using Instagram API Scraper?

It is tough to gauge the required resources for data collection due to the variable nature of use cases while scraping data. Due to this, performing a trial run is the best solution with the small input sample and restricted output for the sample input. Doing this will give you an estimated cost per scrape that you can scale up depending on your data requirement.

Usually, you'll save more on choosing the higher subscription plan of our Instagram API scraping service in the long term. You can check out the detailed tutorial or visit the pricing page.

Can I Use Instagram API Scraper Legally?

We have designed our Instagram data scraping tool for ethical use that doesn't extract any personal data, like user location, contact details, or gender. It only collects publicly available data from the social media platform. Therefore, our scraper is safe for users. But please note that you unknowingly may get some personal data in the scraper output.

There are several regulations worldwide to protect personal data, like GDPR in Europe. Without any genuine reason, you shouldn't scrape any private information. If you need to clarify the legitimacy of the reason, you must seek advice from your advocate.

Input Parameters of Instagram API Scraper

The Instagram data extractor needs JSON input with the Instagram page list you want to visit. Go to the input tab to learn more with examples.

Output Example of Instagram API Scraper

The scraper saves its output in a usable dataset. All items have separate locations in the dataset.

You can handle the scraper output in any programming language like PHP, Python, NPM, or Node.js. Check out the API reference to see how to get results using the Instagram data scraping tool.

Scraped Output from Selected Instagram Posts

Please remember that you will see ownerUsername and ownerFullName only from profile feed posts. It is a similar case with locations and hashtags. To collect the topPosts, you must extract details from profile-tag-location with zero maximum items.

{ "id": "2872941012581150166", "type": "Sidecar", "shortCode": "CfevKEjjO3W", "caption": "Friday is just Party spelled backwards.", "hashtags": [], "mentions": [], "url": "https://www.instagram.com/p/CfevKEjjO3W/", "commentsCount": 1, "topComments": [ { "id": "17965588192732482", "text": "Ytrap is that you?", "created_at": 1656701973, "owner": { "id": "53055140", "profile_pic_url": "https://scontent-gru2-2.cdninstagram.com/v/t51.2885-19/291172308_1433310463818654_3392274096989976793_n.jpg?stp=dst-jpg_s150x150&_nc_ht=scontent-gru2-2.cdninstagram.com&_nc_cat=106&_nc_ohc=Ku3tiqvt6Q0AX-9CimU&edm=APU89FABAAAA&ccb=7-5&oh=00_AT80-LQ4EuJGW-ZA4B-OfZx1RNAGDr75nZCA5s3J2_gBug&oe=630E6B2E&_nc_sid=86f79a", "username": "mr.bearightside" } } ], "dimensionsHeight": 719, "dimensionsWidth": 1080, "displayUrl": "https://scontent-gru2-2.cdninstagram.com/v/t51.2885-15/290965101_448500773766930_1387067205275170103_n.jpg?stp=dst-jpg_e35_s1080x1080&_nc_ht=scontent-gru2-2.cdninstagram.com&_nc_cat=106&_nc_ohc=QA0j3KG7tpoAX_jXgft&edm=APU89FABAAAA&ccb=7-5&oh=00_AT-KY48VGPY4FOqpuXTbO0wxzyXEOLYUGBThMvEeSAcVXA&oe=630D6B35&_nc_sid=86f79a", "images": [ "https://scontent-gru2-2.cdninstagram.com/v/t51.2885-15/290965101_448500773766930_1387067205275170103_n.jpg?stp=dst-jpg_e35_s1080x1080&_nc_ht=scontent-gru2-2.cdninstagram.com&_nc_cat=106&_nc_ohc=QA0j3KG7tpoAX_jXgft&edm=APU89FABAAAA&ccb=7-5&oh=00_AT-KY48VGPY4FOqpuXTbO0wxzyXEOLYUGBThMvEeSAcVXA&oe=630D6B35&_nc_sid=86f79a", "https://scontent-gru1-1.cdninstagram.com/v/t51.2885-15/290949279_336605095307254_1099428386212862812_n.jpg?stp=dst-jpg_e35_s1080x1080&_nc_ht=scontent-gru1-1.cdninstagram.com&_nc_cat=110&_nc_ohc=rhe0mCQ9jGAAX9ihMxN&edm=APU89FABAAAA&ccb=7-5&oh=00_AT9dDwnTllwCJ_aalZK_RXZlKpVS96wej4NBSusGt2-AWA&oe=630EC3D9&_nc_sid=86f79a", "https://scontent-gru2-1.cdninstagram.com/v/t51.2885-15/291215314_889731762429619_8092846469479361036_n.jpg?stp=dst-jpg_e35_s1080x1080&_nc_ht=scontent-gru2-1.cdninstagram.com&_nc_cat=107&_nc_ohc=wdlfzclgugwAX-nCggP&edm=APU89FABAAAA&ccb=7-5&oh=00_AT-ZlpRQ1SOSG5ccS7IK86I1RP7qMo3RipOPxvDbm8Lhxg&oe=630E5BA3&_nc_sid=86f79a", "https://scontent-gru1-1.cdninstagram.com/v/t51.2885-15/291347144_576365830557226_4854168139335161027_n.jpg?stp=dst-jpg_e15_fr_s1080x1080&_nc_ht=scontent-gru1-1.cdninstagram.com&_nc_cat=110&_nc_ohc=jSOCbbR1KVMAX8ogn6h&edm=APU89FABAAAA&ccb=7-5&oh=00_AT_7IGpfxGGI4-AIUOo39LZPRvff_8VN3RaKGr2NuBDjmQ&oe=630D2001&_nc_sid=86f79a" ], "likesCount": 16, "timestamp": "2022-07-01T18:47:58.000Z", "childPosts": [ { "id": "2872941008219162995", "type": "Image", "caption": "", "hashtags": [], "mentions": [], "url": null, "commentsCount": 0, "topComments": [], "dimensionsHeight": 719, "dimensionsWidth": 1080, "displayUrl": "https://scontent-gru2-2.cdninstagram.com/v/t51.2885-15/290965101_448500773766930_1387067205275170103_n.jpg?stp=dst-jpg_e35_s1080x1080&_nc_ht=scontent-gru2-2.cdninstagram.com&_nc_cat=106&_nc_ohc=QA0j3KG7tpoAX_jXgft&edm=APU89FABAAAA&ccb=7-5&oh=00_AT-KY48VGPY4FOqpuXTbO0wxzyXEOLYUGBThMvEeSAcVXA&oe=630D6B35&_nc_sid=86f79a", "images": [], "likesCount": null, "timestamp": null, "childPosts": [], "ownerId": null }, { "id": "2872941008504479156", "type": "Image", "caption": "", "hashtags": [], "mentions": [], "url": null, "commentsCount": 0, "topComments": [], "dimensionsHeight": 719, "dimensionsWidth": 1080, "displayUrl": "https://scontent-gru1-1.cdninstagram.com/v/t51.2885-15/290949279_336605095307254_1099428386212862812_n.jpg?stp=dst-jpg_e35_s1080x1080&_nc_ht=scontent-gru1-1.cdninstagram.com&_nc_cat=110&_nc_ohc=rhe0mCQ9jGAAX9ihMxN&edm=APU89FABAAAA&ccb=7-5&oh=00_AT9dDwnTllwCJ_aalZK_RXZlKpVS96wej4NBSusGt2-AWA&oe=630EC3D9&_nc_sid=86f79a", "images": [], "likesCount": null, "timestamp": null, "childPosts": [], "ownerId": null }, { "id": "2872941008210847168", "type": "Image", "caption": "", "hashtags": [], "mentions": [], "url": null, "commentsCount": 0, "topComments": [], "dimensionsHeight": 719, "dimensionsWidth": 1080, "displayUrl": "https://scontent-gru2-1.cdninstagram.com/v/t51.2885-15/291215314_889731762429619_8092846469479361036_n.jpg?stp=dst-jpg_e35_s1080x1080&_nc_ht=scontent-gru2-1.cdninstagram.com&_nc_cat=107&_nc_ohc=wdlfzclgugwAX-nCggP&edm=APU89FABAAAA&ccb=7-5&oh=00_AT-ZlpRQ1SOSG5ccS7IK86I1RP7qMo3RipOPxvDbm8Lhxg&oe=630E5BA3&_nc_sid=86f79a", "images": [], "likesCount": null, "timestamp": null, "childPosts": [], "ownerId": null }, { "id": "2872941008412089063", "type": "Image", "caption": "", "hashtags": [], "mentions": [], "url": null, "commentsCount": 0, "topComments": [], "dimensionsHeight": 720, "dimensionsWidth": 1080, "displayUrl": "https://scontent-gru1-1.cdninstagram.com/v/t51.2885-15/291347144_576365830557226_4854168139335161027_n.jpg?stp=dst-jpg_e15_fr_s1080x1080&_nc_ht=scontent-gru1-1.cdninstagram.com&_nc_cat=110&_nc_ohc=jSOCbbR1KVMAX8ogn6h&edm=APU89FABAAAA&ccb=7-5&oh=00_AT_7IGpfxGGI4-AIUOo39LZPRvff_8VN3RaKGr2NuBDjmQ&oe=630D2001&_nc_sid=86f79a", "images": [], "likesCount": null, "timestamp": null, "childPosts": [], "ownerId": null } ], "ownerFullName": "Apify", "ownerUsername": "apifytech", "ownerId": "29230178602" }

Scraped Output from Selected Instagram Comments

It helps to get three replies in different output formats. So you can perform the scraper's separate run, Extract Instagram data with API scraper, including posts with comments, and execute it for other data types.

{ "url": "https://www.instagram.com/p/CgpwtwVJ66a/", "id": "17950726027923736", "text": "@romipv15 ❤️", "created_at": 1659461955, "owner": { "id": "4067198760", "is_verified": false, "profile_pic_url": "https://instagram.fala2-1.fna.fbcdn.net/v/t51.2885-19/143927761_455013982320583_4616411511060627850_n.jpg?stp=dst-jpg_s150x150&_nc_ht=instagram.fala2-1.fna.fbcdn.net&_nc_cat=107&_nc_ohc=EIIEWfCExZEAX85uHFk&edm=AP_V10EBAAAA&ccb=7-5&oh=00_AT-RbIPc2nJllSN-motZ18UV8Ti1bAvZXk8VorW9c9D34w&oe=630F5D10&_nc_sid=4f375e", "username": "devoid.wolf" }, "repliesCount": 1, "replies": [ { "id": "17967877732740996", "text": "@devoid.wolf loviu preciosooo❤️❤️", "created_at": 1659476569, "owner": { "id": "10177018382", "is_verified": false, "profile_pic_url": "https://instagram.fala2-1.fna.fbcdn.net/v/t51.2885-19/298163874_1379094759167553_1722689499543189016_n.jpg?stp=dst-jpg_s150x150&_nc_ht=instagram.fala2-1.fna.fbcdn.net&_nc_cat=109&_nc_ohc=EEqIFcyUo9UAX99b-UQ&edm=AP_V10EBAAAA&ccb=7-5&oh=00_AT8_Pw_OsX_49w0IE8cJlfKDJYBh6Kl_tSWFVgcLcS-82A&oe=630EACF1&_nc_sid=4f375e", "username": "romipv15" }, "likesCount": 0 } ], "likesCount": 1 }

Instagram API Scraper with Integrations

Lastly, you can integrate the Instagram data extractor with any web application or cloud services using integrations available on our platform. You can connect the scraper with GitHub, Zapier, Make, Slack, Google Sheets, and other platforms. You can also try webhooks to commence an action for event occurrence, like the successful execution of the Instagram API data scraper.

Using Instagram API Crawler with Real Data API Actor

Our actor gives programmatic permission to access the Real Data API platform. We have organized the actor around RESTful HTTP endpoints, allowing you to schedule, manage, and execute scrapers from our platform. The actor also allows you to monitor the performance of Instagram scraper for API data, access datasets, retrieve results, update or create scraper versions, etc.

You can use our client PyPl package to access the actor using Python and the client NPM package using Node.js.

Do you want to extract Instagram posts, hashtags, or comments?

We have dedicated Instagram scraping tools to collect specific data. Only submit single or multiple usernames or links on Instagram and run the scraper. You have to make a few settings to get quick results to use them.

  • Instagram Post Scraper
  • Instagram Tagged Scraper
  • Instagram Hashtag Scraper
  • Instagram Reel Scraper
  • Instagram Profile Scraper
  • Instagram Comment Scraper
  • Quick Instagram Posts Checker

Can't you get the required data using Instagram API Scraper? Develop your Customized Scraper

If this scraper can't fulfill your exact data requirement from Instagram, you can develop your scraper with customization. Multiple templates are available on our platform, with Javascript, Python, TypeScript, and other coding languages. Optionally, you can write the program from scratch using the open-source programming library Crawlee. It is your choice to make your tool available to the public.

If you want to avoid developing the scraper yourself, we are happy to help you with customized solutions.

Share Your Feedback

Our team constantly works to improve the scraper performance on our platform. If you have any technical suggestions, version updates, or a bug and want to share it with us, you can create an issue from the issue tab available in your console account.

Industries

Check out how industries use Instagram API Scraper worldwide.

saas-btn.webp

Marketing and Media

You should have a Real Data API account to execute the program examples. Replace < YOUR_API_TOKEN > in the program using the token of your actor. Read about the live APIs with Real Data API docs for more explanation.

import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with API token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare actor input
const input = {
    "directUrls": [
        "https://www.instagram.com/humansofny/"
    ],
    "resultsType": "details",
    "resultsLimit": 200,
    "searchContext": "hashtag",
    "searchLimit": 1,
    "proxy": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    }
};

(async () => {
    // Run the actor and wait for it to finish
    const run = await client.actor("apify/instagram-api-scraper").call(input);

    // Fetch and print actor results from the run's dataset (if any)
    console.log('Results from dataset');
    const { items } = await client.dataset(run.defaultDatasetId).listItems();
    items.forEach((item) => {
        console.dir(item);
    });
})();
from apify_client import ApifyClient

# Initialize the ApifyClient with your API token
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the actor input
run_input = {
    "directUrls": ["https://www.instagram.com/humansofny/"],
    "resultsType": "details",
    "resultsLimit": 200,
    "searchContext": "hashtag",
    "searchLimit": 1,
    "proxy": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    },
}

# Run the actor and wait for it to finish
run = client.actor("apify/instagram-api-scraper").call(run_input=run_input)

# Fetch and print actor results from the run's dataset (if there are any)
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)
# Set API token
API_TOKEN=<YOUR_API_TOKEN>

# Prepare actor input
cat > input.json <<'EOF'
{
  "directUrls": [
    "https://www.instagram.com/humansofny/"
  ],
  "resultsType": "details",
  "resultsLimit": 200,
  "searchContext": "hashtag",
  "searchLimit": 1,
  "proxy": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
EOF

# Run the actor
curl "https://api.apify.com/v2/acts/apify~instagram-api-scraper/runs?token=$API_TOKEN" \
  -X POST \
  -d @input.json \
  -H 'Content-Type: application/json'

Submit Instagram Links to Collect Data

directUrls Optional Array

Add single or multiple links to Instagram credentials to scrape.

What type of data do you need for every Instagram page?

resultsType Optional Enum

Finalize what type of data you need from every link of the Instagram page or search output.

Note: You must choose the right source page depending on the URL. For example, you can extract comments from the post URL, not user profiles.

Options:

  • Details String
  • Comments String
  • Posts String
  • Stories String

Maximum Items

resultsLimit Optional Integer

Decide how many comments or posts you want to scrape from every URL of the social media page or the platform. The scraper will give you a single post from every page if you set the maximum number of items to one. If you mention details types, the scraper will ignore max items. Remember that there is a separate limit for every Instagram page.

Add Metadata

addParentData Optional Boolean

It is a parameter for feed items to add source data to results. For example, the profile is for profile posts; a hashtag is for tag posts.

Tagged Posts

isUserTaggedFeedURL Optional Boolean

Collect tagged Instagram posts for every user profile.

Search

Optional String Share a search term the scraper will use to find Instagram for places, hashtags, or profiles.

It is optional, but you must profile Instagram links or use this field.

Search Type

searchContext Optional Enum

Provide the page types you want to search for, like profiles, hashtags, or locations on the platform.

Options:

  • User String
  • Place String
  • Hashtag String

Search Results Limit

searchLimit Optional Integer

It is the input parameter for the number of search outputs, like profiles, hashtags, or pages that you want to process using the scraper. If you keep it to one, for example, tea, the scraper will collect only one result for the selected keyword. Changing it to three will give more options like tea, tea-lover, teatime, etc. Instagram displays a maximum of 55 results.

Scrape Until Date

scrapePostsUntilDate Optional String

It scrapes Instagram posts from the current date till it reaches older posts than the submitted date. For date submission, YYYY-MM-DD is the preferred format.

Older Than

fromDate Optional String

It helps to scrape Instagram posts from the selected date to the past. You have to select the date in relative time or YYYY-MM-DD format.

Newer Than

untilDate Optional String

It helps to Scrape Instagram posts from the submitted date to the current date. You have to select the date in relative time or YYYY-MM-DD format.

Proxy Configuration

proxy Required Object

You can use a proxy server from our platform or set up your proxies. But the scraper doesn't allow data center proxy servers.

Max Request Retries

maxRequestRetries Optional Integer

Choose the number of times the scraper will retry the scraping process if there is any error or blockage.

Debug Log

debugLog Optional Boolean

Consider allowing a more verbose login to help you understand activities during the scraping process.

{
  "directUrls": [
    "https://www.instagram.com/humansofny/"
  ],
  "resultsType": "details",
  "resultsLimit": 200,
  "addParentData": false,
  "searchContext": "hashtag",
  "searchLimit": 1,
  "proxy": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  },
  "maxRequestRetries": 10,
  "debugLog": false
}