Instagram Posts Scraper avatar

Instagram Posts Scraper

Pricing

from $8.00 / 1,000 results

Go to Apify Store
Instagram Posts Scraper

Instagram Posts Scraper

Scrape posts and reels from any Instagram profile (e.g. instagram.com/meta) with a start/end date filter. Returns caption, hashtags, likes, comments, views, media URLs, location, tagged users, music and profile stats. Requires a session (cookies or automated login).

Pricing

from $8.00 / 1,000 results

Rating

0.0

(0)

Developer

code craker

code craker

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

2

Monthly active users

2 days ago

Last modified

Categories

Features

Limited permissions

Share

Apify actor that scrapes the posts of one or more Instagram profiles (e.g. https://www.instagram.com/meta) with an optional start/end date filter.

A session is required. Instagram only serves profile posts to logged-in sessions. The actor authenticates in priority order:

  1. cookies input — a JSON cookie export from a logged-in browser (Cookie-Editor / EditThisCookie); the sessionid cookie carries the session
  2. IG_COOKIES secret env var on the actor (same JSON, or a name=value; ... string)
  3. the cached session in the instagram-session key-value store (needs full permissions)
  4. automated login with igUsername/igPassword (or IG_USERNAME/IG_PASSWORD)

Always use a throwaway account. Optionally set IG_PROXY_SESSION (e.g. igacct1) so the account keeps one exit IP across runs.

How it works

A real Chrome (Playwright) opens each profile with the session. The posts the page loads itself (embedded in the HTML and from its PolarisProfilePostsQuery GraphQL call) are taken first. The actor then scrolls once so the page sends its own pagination query (PolarisProfilePostsTabContentQuery_connection) and replays that request with the end_cursor from each page, 12 posts per request, newest first. If replaying fails it falls back to scrolling the profile page.

The grid data has no view counts, location or alt text, so with enrichPosts on (the default) each kept post is also fetched from /api/v1/media/{id}/info/. If Instagram rate-limits these requests, enrichment turns off for the rest of the run and posts are still saved.

Profile details (followers, following, posts, verified, business) come from the profile page's own query.

Input

{
"profileUrls": ["https://www.instagram.com/meta", "@nasa", "natgeo"],
"numberOfPosts": 50,
"start_date": "2026-08-01",
"end_date": "2026-08-31",
"includePinned": true,
"enrichPosts": true,
"proxyConfiguration": { "useApifyProxy": true, "apifyProxyGroups": ["RESIDENTIAL"], "apifyProxyCountry": "US" }
}
  • Profiles can be URLs, @username or plain usernames. Post or reel URLs are rejected. profileUrl (single) and usernames are also accepted.
  • numberOfPosts is per profile (alias resultsLimit, max 5,000). scrapeAll: false takes only the first page.
  • start_date / end_date (yyyy-mm-dd, inclusive, UTC) filter on each post's publish time. The feed is newest first, so the actor stops at the first post older than start_date. Pinned posts are out of order, so they are checked individually and never end the scan. Aliases: timeSince / timeUntil.
  • includePinned: false drops posts pinned to the top of the grid.
  • debug: true saves Instagram's responses, a screenshot and the HTML to the run's key-value store.

Output

One dataset item per post (abridged):

{
"id": "4007130457085500194",
"code": "DecL-uHOtsi",
"url": "https://www.instagram.com/reel/DecL-uHOtsi/",
"text": "@nataszko is an illustrator who ...",
"hashtags": [],
"mentions": ["nataszko"],
"created_at": "2026-10-13T16:05:30.000Z",
"createdUtc": 1791907530,
"mediaType": "video",
"productType": "clips",
"isVideo": true,
"isReel": true,
"likes": 102781,
"comments": 4412,
"views": 1543210,
"reshares": 2295,
"videoDuration": 61.077,
"videoUrl": "https://scontent...mp4",
"displayUrl": "https://scontent...jpg",
"images": ["https://scontent...jpg"],
"childPosts": [],
"carouselCount": null,
"music": { "title": "Original audio", "artist": "meta", "audioId": "..." },
"location": null,
"taggedUsers": [{ "username": "nataszko", "fullName": "Natasha Polozenko", "userId": "..." }],
"coauthors": [{ "username": "nataszko", "fullName": "Natasha Polozenko", "userId": "..." }],
"isPinned": false,
"isPinnedInReelsTab": false,
"isPaidPartnership": false,
"commentsDisabled": false,
"likesHidden": false,
"username": "meta",
"fullName": "Meta",
"userId": "28247116907",
"isVerified": true,
"profileUsername": "meta",
"profileFullName": "Meta",
"profileFollowersCount": 6321603,
"profileFollowingCount": 35,
"profilePostsCount": 1804,
"profileIsVerified": true,
"profileIsBusiness": true,
"profileUrl": "https://www.instagram.com/meta/",
"inputUrl": "https://www.instagram.com/meta",
"scrapedAt": "2026-11-06T11:25:13.000Z"
}
  • username is the post's author. Collab posts on the profile's grid can have another author; profileUsername is always the scraped profile.
  • views is null for photos (and for videos when enrichment is off or rate-limited).
  • Each profile's details are also saved to the key-value store as PROFILE_<username>.

Local development

npm install
mkdir -p storage/key_value_stores/default
cat > storage/key_value_stores/default/INPUT.json <<'JSON'
{ "profileUrl": "https://www.instagram.com/meta", "numberOfPosts": 20,
"cookies": [ ...exported from a logged-in browser... ],
"proxyConfiguration": { "useApifyProxy": false } }
JSON
npm start

Deploy with apify push.