Guides / Scrape Instagram
How to Scrape Instagram in 2026
Instagram uses aggressive anti-bot protection, login walls, and JavaScript-heavy rendering to prevent automated access. This guide focuses on scraping public profile pages, which expose follower counts, bio information, and recent post links in the page metadata. With Browser7, you get fully rendered profile data in a single API call.
What makes Instagram hard to scrape
Login walls
Instagram aggressively prompts visitors to log in, often showing a modal overlay that blocks page content after a few seconds. Public profiles still expose key data in meta tags, but the visible page content is increasingly gated behind authentication.
Anti-bot detection
Instagram uses sophisticated browser fingerprinting, behavioral analysis, and IP reputation scoring. Datacenter IPs are blocked immediately, and even residential proxies face challenges if request patterns look automated.
JavaScript-rendered content
Instagram is a single-page application that renders content entirely with JavaScript. A simple HTTP request returns minimal HTML. You need a real browser to get profile data, post grids, and engagement metrics.
Rate limiting
Instagram enforces strict rate limits and will block IPs that make too many requests. Exceeding these limits results in temporary bans or permanent blocks on the IP address.
Scrape an Instagram profile
Browser7 handles proxy rotation, browser fingerprinting, CAPTCHA solving, and JavaScript rendering automatically. This example renders a public Instagram profile page and returns the fully rendered HTML.
from browser7 import Browser7
client = Browser7(
api_key="b7_your_api_key",
base_url="https://ca-api.browser7.com/v1"
)
result = client.render(
"https://www.instagram.com/natgeo/",
country_code="US",
)
print(result.html)That is the complete code. No proxy configuration, no browser setup, no login handling. The response contains the fully rendered HTML of the Instagram profile page, including meta tags with follower counts, bio, and post data.
Data you can extract
Public Instagram profiles expose key data through meta tags and the rendered page. Common data points to extract:
Profile stats
- Follower count
- Following count
- Total post count
- Verified badge status
- Account category
Bio and about
- Display name
- Username/handle
- Bio text
- Profile picture URL
- External website link
Recent posts
- Post URLs and shortcodes
- Thumbnail image URLs
- Post type (image, video, carousel)
- Caption text (on detail pages)
- Post timestamps
Engagement metrics
- Like counts (on detail pages)
- Comment counts (on detail pages)
- View counts for videos
- Engagement rate calculations
- Growth trends over time
Complete example: render and parse profile data
Here is a complete example that renders a public Instagram profile and extracts structured data from the meta tags. Instagram embeds follower counts, following counts, and post counts in the og:description meta tag, and the display name and username in the og:title meta tag.
from browser7 import Browser7
from bs4 import BeautifulSoup
import re
import json
client = Browser7(
api_key="b7_your_api_key",
base_url="https://ca-api.browser7.com/v1"
)
result = client.render(
"https://www.instagram.com/natgeo/",
country_code="US",
)
soup = BeautifulSoup(result.html, "html.parser")
profile = {
"username": None,
"fullName": None,
"bio": None,
"followers": None,
"following": None,
"posts": None,
}
# Username from og:title meta tag
og_title = soup.find("meta", property="og:title")
if og_title:
content = og_title.get("content", "")
# Format: "National Geographic (@natgeo)"
match = re.search(r"@(\w+)", content)
if match:
profile["username"] = match.group(1)
# Full name is before the (@username) part
name_match = re.match(r"(.+?)\s*\(", content)
if name_match:
profile["fullName"] = name_match.group(1).strip()
# Stats from og:description meta tag
og_desc = soup.find("meta", property="og:description")
if og_desc:
content = og_desc.get("content", "")
# Format: "275M Followers, 194 Following, 32K Posts - ..."
followers_match = re.search(r"([\d.]+[MKB]?)\s*Followers", content)
if followers_match:
profile["followers"] = followers_match.group(1)
following_match = re.search(r"([\d.,]+[MKB]?)\s*Following", content)
if following_match:
profile["following"] = following_match.group(1)
posts_match = re.search(r"([\d.,]+[MKB]?)\s*Posts", content)
if posts_match:
profile["posts"] = posts_match.group(1)
# Bio is after the dash
bio_match = re.search(r"Posts\s*-\s*(.+)", content)
if bio_match:
profile["bio"] = bio_match.group(1).strip()
print(json.dumps(profile, indent=2))Meta tag formats may change if Instagram updates their page structure. Inspect the current page if any fields return null.
Sample output:
{
"username": "natgeo",
"fullName": "National Geographic",
"bio": "Experience the world through the eyes of National Geographic photographers.",
"followers": "275M",
"following": "194",
"posts": "32K"
}Extract recent post links
The profile page contains links to recent posts. Extract these URLs to build a list of posts you can then scrape individually for detailed engagement data, captions, and comments.
from browser7 import Browser7
from bs4 import BeautifulSoup
client = Browser7(
api_key="b7_your_api_key",
base_url="https://ca-api.browser7.com/v1"
)
result = client.render(
"https://www.instagram.com/natgeo/",
country_code="US",
)
soup = BeautifulSoup(result.html, "html.parser")
# Extract links to recent posts
post_links = []
for link in soup.select('a[href*="/p/"]'):
href = link.get("href")
if href and href not in post_links:
post_links.append(href)
for url in post_links[:12]:
print(f"https://www.instagram.com{url}")Take a screenshot of the profile
Capture Instagram profiles as images for influencer analysis reports, brand monitoring dashboards, or tracking follower growth over time.
import base64
from browser7 import Browser7
client = Browser7(
api_key="b7_your_api_key",
base_url="https://ca-api.browser7.com/v1"
)
result = client.render(
"https://www.instagram.com/natgeo/",
country_code="US",
block_images=False,
include_screenshot=True,
screenshot_full_page=True,
screenshot_format="png"
)
# Save the screenshot
with open("instagram-profile.png", "wb") as f:
f.write(base64.b64decode(result.screenshot))
print("Screenshot saved")What this costs
Every Instagram page render costs $0.01 - the same as any other website. Residential proxies, JavaScript rendering, CAPTCHA solving, and screenshots are all included. There are no per-domain surcharges, no credit multipliers, and no bandwidth fees.
Scraping 1,000 Instagram profiles costs $10. You know this before you start, not after.