Home › Instagram Scraper in Python

Instagram Scraper in Python: 3 Ways That Work in 2026

Updated July 2026 · Working code included · Affiliate disclosure

Instagram has no official API for public data you don't own, so Python developers scrape it one of three ways: a local open-source library, a cloud scraping platform, or hand-rolled requests against private endpoints. Two of those work reliably in 2026. Here's the code for both — and why we'd skip the third.

Method 1: Instaloader (free, runs locally)

Instaloader is the standard open-source choice: MIT-licensed, actively maintained, and good for small jobs from your own machine.

pip install instaloader
import instaloader

L = instaloader.Instaloader()
profile = instaloader.Profile.from_username(L.context, "natgeo")

print(profile.followers, profile.biography)

# Iterate recent public posts
for post in profile.get_posts():
    print(post.date_utc, post.likes, post.caption[:80])
    if post.likes < 1000:
        break

The catch: every request comes from your IP. Instagram rate-limits hard — expect 401 Unauthorized or temporary blocks after a few hundred requests. Fine for a nightly job on a handful of profiles; painful for anything bigger unless you add paid proxies.

Method 2: Apify client (cloud, no proxy management)

For anything beyond hobby scale, it's cheaper in practice to let a platform handle proxies, retries and parsing. The Apify Instagram Scraper has an official Python client, a free tier (~3,300 posts/month), then $1.50 per 1,000 posts.

pip install apify-client
from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_TOKEN")  # free account token

run = client.actor("apify/instagram-scraper").call(run_input={
    "directUrls": ["https://www.instagram.com/natgeo/"],
    "resultsType": "posts",
    "resultsLimit": 200,
})

for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item["timestamp"], item["likesCount"], item["caption"][:80])

Method 3: requests + private endpoints (don't)

Tutorials still float around showing how to hit Instagram's internal GraphQL endpoints with requests and a session cookie. In 2026 this is the worst option: the endpoints change without notice, logged-in scraping risks the account you used, and Meta actively fingerprints these clients. Everything it offers, the two methods above do more safely.

Which method should you use?

ApproachCostScale ceilingMaintenance
InstaloaderFree~hundreds of requests/day per IPYou handle blocks & retries
Apify clientFree tier, then $1.50/1k postsEffectively unlimitedNone — managed
Private endpoints"Free" + burned accountsLowConstant breakage

Not a Python person after all? The same Apify scraper runs entirely in the browser with no code, and there's a REST API if you're integrating from another language.

Skip the proxy headaches

Free tier ≈ 3,300 posts/month — enough to test any pipeline before paying a cent.

Get your free Apify token →