Instagram Data Scraper avatar

Instagram Data Scraper

Under maintenance

Pricing

Pay per usage

Go to Apify Store
Instagram Data Scraper

Instagram Data Scraper

Under maintenance

Scrape public Instagram profile data, posts, captions, hashtags, engagement metrics, and profile information. Export results as JSON, CSV, or Excel. Fast, reliable, and easy to integrate into automation workflows.

Pricing

Pay per usage

Rating

0.0

(0)

Developer

Mahir Sutar

Mahir Sutar

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

2 days ago

Last modified

Share

Instagram Scraper โ€” Crawlee + Playwright

Search Instagram by hashtag or keyword, collect matching accounts, and extract their full profile info including bio, followers, website, email, and more.


๐Ÿ“ Project Structure

instagram-scraper/
โ”œโ”€โ”€ src/
โ”‚ โ”œโ”€โ”€ main.js โ† Entry point (run this)
โ”‚ โ”œโ”€โ”€ config.js โ† โœ๏ธ Edit hashtags, keywords & settings here
โ”‚ โ”œโ”€โ”€ routes.js โ† Page handlers (hashtag / search / profile)
โ”‚ โ”œโ”€โ”€ parser.js โ† Profile data extractor
โ”‚ โ”œโ”€โ”€ cookieLoader.js โ† Reads cookies.json
โ”‚ โ””โ”€โ”€ exporter.js โ† Saves JSON + CSV output
โ”œโ”€โ”€ cookies.json โ† โœ๏ธ Paste your Instagram cookies here
โ”œโ”€โ”€ cookies.example.json โ† Format reference
โ”œโ”€โ”€ output/ โ† Created automatically
โ”‚ โ”œโ”€โ”€ results.json
โ”‚ โ”œโ”€โ”€ results.csv
โ”‚ โ””โ”€โ”€ summary.txt
โ””โ”€โ”€ package.json

๐Ÿš€ Quick Start

1. Install dependencies

npm install
npx playwright install chromium

2. Configure what to scrape

Edit src/config.js:

hashtags: ['#photography', '#travel'], // hashtags to search
keywords: ['digital art', 'AI tools'], // keywords to search
maxAccountsPerSource: 50, // accounts to collect per source

Instagram blocks unauthenticated scrapers aggressively. Using your account's cookies dramatically improves results.

How to get cookies (Chrome):

  1. Install the EditThisCookie extension
  2. Log in to Instagram in Chrome
  3. Click EditThisCookie โ†’ Export (copies JSON to clipboard)
  4. Paste into cookies.json

Or use the Cookie-Editor extension โ€” export as JSON and paste into cookies.json.

The minimum cookies needed are: sessionid, csrftoken, ds_user_id

4. Run

$npm start

๐Ÿ“Š Output

Results are saved to the output/ folder:

FileDescription
results.jsonFull data, all fields
results.csvSpreadsheet-friendly
summary.txtCount per source

Fields collected per account

FieldDescription
usernameInstagram handle
fullNameDisplay name
bioFull biography text
websiteBio website link
emailEmail extracted from bio
phonePhone from bio/business profile
followersCountFollower count
followingCountFollowing count
postsCountNumber of posts
categoryBusiness category (if set)
isVerifiedBlue tick
isPrivatePrivate account flag
externalUrlBio link
profileUrlDirect Instagram URL
sourceWhich hashtag/keyword found this account
scrapedAtTimestamp

โš™๏ธ Configuration Options (src/config.js)

SettingDefaultDescription
hashtags['#photography']Hashtags to scrape
keywords['digital art']Keywords to search
maxAccountsPerSource50Accounts per hashtag/keyword
maxPostsToScan30Posts to check per hashtag page
maxRequests500Hard cap on total requests
maxConcurrency2Parallel browser tabs
headlesstrueRun without visible browser
delayMs2000Base delay between requests (ms)

โš ๏ธ Tips & Troubleshooting

  • Always use cookies โ€” Instagram requires login for most data
  • Keep concurrency low (1โ€“2) to avoid rate limiting
  • Check output/debug-hashtag-*.png if a hashtag returns no results โ€” it shows what the browser saw
  • Crawlee stores intermediate data in storage/ โ€” delete it with npm run clean between runs
  • Instagram frequently updates its page structure; the parser uses multiple fallback strategies

๐Ÿงช Test a single profile

You can quickly test the profile parser by adding a profile URL directly:

// In src/main.js, add to startUrls:
{
url: 'https://www.instagram.com/natgeo/',
label: 'PROFILE',
userData: { source: 'manual-test' },
}

This tool is for personal research and educational use only. Scraping Instagram may violate their Terms of Service. Use responsibly and respect rate limits.