DEV Community

Cover image for How to Scrape Instagram Profile Stats with Instagram Profile & Followers Scraper
ReventaData
ReventaData

Posted on Originally published at apify.com

How to Scrape Instagram Profile Stats with Instagram Profile & Followers Scraper

By the end of this tutorial you will have a short Python script that reads public Instagram profiles by username and prints each one's name, bio, follower count, following count and post count. The output is one structured row per profile, ready to save, sort or filter.

The tool is Instagram Profile & Followers Scraper (reventadata/instagram-profile-scraper), an Apify Actor. You give it usernames and it returns one row per profile. It reads the public profile page of each account, with no login. It does not read posts or lists of followers. "Followers" in its name refers to the follower count shown on each profile.

Instagram is a trademark of its owner. This Actor is not affiliated with, authorised by or endorsed by Instagram or Meta Platforms.


Prerequisites

You need three things:

  1. Python 3.11 or newer. The Apify client for Python 3.x requires it.
  2. A free Apify account, which you can create with an email address or a GitHub login.
  3. Your API token, from Settings > API & Integrations in Apify Console.

Install the client and export the token:

pip install -U "apify-client~=3.0"
export APIFY_API_TOKEN="your_apify_token_here"
Enter fullscreen mode Exit fullscreen mode

No scraping code is needed on your side. The Actor reads the pages for you, so the script only starts the run and reads the rows.


What you'll achieve

We will read the public profile of instagram, the official Instagram account, and print its name, bio and three counts. Then we will add a follower threshold and see how it changes the rows.

Each profile that passes the filters becomes one row. A list of ten usernames can return up to ten rows, and the maxItems field caps the total for a run. Because the rows are plain fields, the same script works for comparing account sizes across a list of creators, or for keeping a table of post counts over time. Only the input changes.


Step 1: Open Instagram Profile & Followers Scraper

Open the Instagram Profile & Followers Scraper page on Apify Store. The Try for free button there opens the Actor in Apify Console. This tutorial calls the Actor from Python with the Apify API client, so you only need its name, reventadata/instagram-profile-scraper.


Step 2: Choose the usernames and limits

The input has three fields that matter here:

  • usernames: a list of public usernames. A leading @ is removed, and a full profile link such as https://www.instagram.com/instagram/ works as well.
  • maxItems: the most rows one run saves. If you leave it out, the Actor saves up to 20.
  • minFollowers: an optional whole number. Profiles below it are left out of the rows. When this field is set, a profile whose follower count cannot be read is left out too.

If the same username appears twice in the list, the second copy is skipped once the first has produced a row.

This is the input the script below uses:

{
    "usernames": ["instagram"],
    "maxItems": 10
}
Enter fullscreen mode Exit fullscreen mode

Step 3: Run it from Python

Save this script as profiles.py. It starts the Actor, waits for the run to finish, reads the dataset and prints a summary for each profile:

import os
from apify_client import ApifyClient

# 1. Initialise the client with your token from the environment
client = ApifyClient(os.environ["APIFY_API_TOKEN"])

# 2. Name the profiles to read and cap the number of rows
run_input = {
    "usernames": ["instagram"],
    "maxItems": 10,
}

# 3. Start the Actor and wait for it to finish
run = client.actor("reventadata/instagram-profile-scraper").call(run_input=run_input)
if run is None or run.status != "SUCCEEDED":
    status = run.status if run else "unknown"
    raise SystemExit(f"Run did not succeed (status: {status}).")

# 4. Read the rows from the run's default dataset
items = client.dataset(run.default_dataset_id).list_items().items
print(f"Retrieved {len(items)} profile(s).\n")

# 5. Print a summary for each profile
for item in items:
    print(f"@{item['username']} ({item.get('fullName')})")
    print(f"  followers: {item.get('followersCount')}, following: {item.get('followingCount')}, posts: {item.get('postsCount')}")
    print(f"  bio: {item.get('biography')}")
Enter fullscreen mode Exit fullscreen mode

Run it with python profiles.py. The Actor works through the usernames one at a time, so keep the list short while you test.


Step 4: Read the output

For the input above, the script prints this. The lines come from the run of 2026-11-16 on the profile @instagram:

Retrieved 1 profile(s).

@instagram (Instagram)
  followers: 686000000, following: 172, posts: 8647
  bio: Discover what's new on Instagram 🔎✨
Enter fullscreen mode Exit fullscreen mode

Each row is one JSON object. This is the row from that run. The avatarUrl field is left out of this sample because it is a long picture link; every other field is as the run returned it:

{
    "id": "instagram",
    "username": "instagram",
    "fullName": "Instagram",
    "biography": "Discover what's new on Instagram 🔎✨",
    "followersCount": 686000000,
    "followingCount": 172,
    "postsCount": 8647,
    "url": "https://www.instagram.com/instagram/",
    "scrapedAt": "2026-11-16T09:39:37.884138+00:00"
}
Enter fullscreen mode Exit fullscreen mode

Understanding your results

Every row has the same ten fields:

Field What it holds
id The username.
username The Instagram username, without the @.
fullName The display name. When the page gives no name, this is the username.
biography The bio text. null when the Actor cannot read one.
followersCount Follower count as a whole number. A saved row always has it.
followingCount Number of accounts followed. null when the Actor cannot read it.
postsCount Number of posts. null when the Actor cannot read it.
avatarUrl Link to the profile picture. null when the Actor cannot read one.
url The profile URL.
scrapedAt The UTC time the row was made, in ISO 8601 format.

The count fields take a shortened count and return a whole number. A count written with a K, M or B suffix is multiplied out, so 10.5K becomes 10500. The sample row above has followersCount of 686000000, which is 686 million.

The row has no ratio field. If you want a following-to-followers ratio, divide the two counts yourself and skip any row where either one is null.


Pro tips

  1. Filter in the Actor when you can. Set minFollowers and the small accounts never reach your rows. A profile whose count cannot be read is dropped too, so a list with a few unreadable accounts will return fewer rows than usernames.
  2. Mind maxItems. When it is left out, the run saves up to 20 rows. Set it to the number of rows you actually want.
  3. Use a clean list. Duplicates are skipped, and a username with a leading @ or a profile link is read the same way as the bare name.
  4. Keep the rows. Save the dataset from each run, or export it as JSON, CSV, Excel or NDJSON from Apify Console, and compare counts from one run to the next.
  5. Check the log for the totals. The run log has a line Run finished: pushed N records to dataset., where N is the number of rows saved.

Troubleshooting

  • Status FAILED with a message about pages that could not be read. The run saved no rows because at least one profile page could not be read. The message names the usernames and the number of pages that failed.
  • Status SUCCEEDED with "nothing matched". The pages loaded but no profile passed the filter. Check whether minFollowers is higher than the counts of the accounts you listed.
  • Fewer rows than usernames. Check minFollowers, duplicates and maxItems, then the final log line from tip 5.
  • The run stops early. If the run runs out of time, the log says so. Usernames after that point are not read, and the rows already saved are kept.

To read the log from Python, use client.log(run.id).get().


Next steps

To repeat a lookup, save the input as an Apify task and attach a schedule, which runs an Actor or task on a cron expression. Datasets export in several formats, and a webhook can notify your application when a run finishes.

For current pricing and details, see the Store page.

Which accounts would you compare? Drop a comment! 💬

About the author: reventadata builds and publishes data extraction Actors on the Apify Store.

Top comments (0)