Instagram Scraper avatar
Instagram Scraper

Pricing

from $0.01 / 1,000 results

Go to Apify Store
Instagram Scraper

Instagram Scraper

Extract comprehensive data from Instagram including profiles, posts, hashtags, comments, and engagement metrics. Features automatic chunking for large scrapes without login, optional authentication for full access, and robust extraction of photos, videos, captions, likes, and user interactions.

Pricing

from $0.01 / 1,000 results

Rating

0.0

(0)

Developer

John Adeolu

John Adeolu

Maintained by Community

Actor stats

0

Bookmarked

9

Total users

5

Monthly active users

20 days ago

Last modified

Share

A professional Apify Actor that extracts comprehensive data from Instagram, including profiles, posts, followers, comments, hashtags, and engagement metrics.

Features

  • ๐Ÿ‘ค Profile Scraping: Extract profile information including bio, followers, following, posts count, verification status
  • ๐Ÿ“ธ Post Extraction: Scrape posts with images, captions, likes, comments, and dates
  • ๐Ÿท๏ธ Hashtag Scraping: Extract posts from specific hashtags
  • ๐Ÿ’ฌ Comments Extraction: Optional detailed comments with author information
  • ๐Ÿ“Š Engagement Metrics: Extract likes, comments count, and other engagement data
  • ๐Ÿ”„ Pagination Support: Automatically scrolls and loads more posts
  • ๐Ÿš€ High Performance: Efficient scraping with proper error handling and retries
  • ๐Ÿ”’ Proxy Support: Built-in Apify Proxy support for reliable scraping

Input

FieldTypeRequiredDescription
usernameStringNo*Instagram username to scrape (without @)
hashtagStringNo*Hashtag to scrape (without #)
postUrlStringNo*Direct URL to a specific Instagram post
maxPostsNumberNoMaximum number of posts to extract (default: 50, max: 1000)
includeCommentsBooleanNoWhether to include comments for each post (default: false)
maxCommentsNumberNoMaximum number of comments per post if includeComments is true (default: 10, max: 100)
includeLikesBooleanNoWhether to include likes count for each post (default: true)
username_loginStringNoOptional: Your Instagram username for login. Without login, you'll get 1-12 posts. With login, up to 1000 posts accessible.
password_loginStringNoOptional: Your Instagram password for login. Only needed if you want to scrape more posts. Can proceed without login.

*At least one of username, hashtag, or postUrl must be provided

Example Input

{
"username": "instagram",
"maxPosts": 100,
"includeComments": true,
"maxComments": 20,
"includeLikes": true
}
{
"hashtag": "photography",
"maxPosts": 50
}
{
"postUrl": "https://www.instagram.com/p/ABC123xyz/"
}

Output

The actor saves results to the Apify Dataset. Output format depends on the input:

Profile Data

{
"username": "instagram",
"fullName": "Instagram",
"bio": "Bringing you closer to the people and things you love.",
"profilePicture": "https://instagram.com/...",
"followers": 1000000,
"following": 100,
"postsCount": 5000,
"isVerified": true,
"isPrivate": false,
"profileUrl": "https://www.instagram.com/instagram/",
"timestamp": "2024-01-10T12:00:00.000Z"
}

Post Data

{
"postId": "ABC123xyz",
"postUrl": "https://www.instagram.com/p/ABC123xyz/",
"username": "instagram",
"mediaUrl": "https://instagram.com/...",
"caption": "Beautiful sunset ๐ŸŒ…",
"likes": 50000,
"commentsCount": 1000,
"date": "2024-01-10T10:00:00.000Z",
"type": "photo",
"comments": [
{
"author": "user123",
"authorUrl": "https://www.instagram.com/user123/",
"text": "Amazing!",
"likes": null
}
],
"timestamp": "2024-01-10T12:00:00.000Z"
}

Hashtag Post Data

{
"postId": "DEF456abc",
"postUrl": "https://www.instagram.com/p/DEF456abc/",
"hashtag": "photography",
"mediaUrl": "https://instagram.com/...",
"caption": "Great shot!",
"likes": 1000,
"commentsCount": 50,
"date": "2024-01-09T15:00:00.000Z",
"type": "photo",
"timestamp": "2024-01-10T12:00:00.000Z"
}

Usage

Local Development

  1. Install dependencies:
$npm install
  1. Run the actor:
$npm start

Apify Platform

  1. Create a new actor on Apify
  2. Upload the actor files
  3. Configure input parameters
  4. Run the actor

Using Apify CLI

apify create instagram-scraper
cd instagram-scraper
# Copy files to the actor directory
apify push
apify call --memory=4096

Output Dataset

Results are saved to the Apify Dataset with different schemas depending on the input:

Profile Schema

  • username: Instagram username
  • fullName: Full display name
  • bio: Profile bio
  • profilePicture: Profile picture URL
  • followers: Number of followers
  • following: Number of accounts following
  • postsCount: Total number of posts
  • isVerified: Whether account is verified
  • isPrivate: Whether account is private
  • profileUrl: Profile URL
  • timestamp: ISO timestamp of extraction

Post Schema

  • postId: Unique post identifier
  • postUrl: Direct URL to the post
  • username: Post author username (if scraping profile)
  • mediaUrl: URL to the post media (image/video)
  • caption: Post caption text
  • likes: Number of likes (if includeLikes is true)
  • commentsCount: Number of comments
  • date: Post date/time
  • type: Post type (photo or video)
  • hashtag: Hashtag (if scraping hashtag)
  • comments: Array of comment objects (if includeComments is true)
  • timestamp: ISO timestamp of extraction

Best Practices

  1. Rate Limiting: Instagram may implement rate limiting for high-volume requests. Consider using Apify Proxy and adding delays.

  2. Max Posts: Start with smaller values (50-100) to test before scaling up to avoid timeouts.

  3. Comments: Enabling comments extraction significantly increases scraping time. Use only when necessary.

  4. Private Accounts: Private accounts cannot be scraped without authentication. The actor will detect private accounts.

  5. Login: Some features (like hashtag scraping) may require login for full access. The actor works without login but may have limitations.

  6. Error Handling: The actor includes comprehensive error handling. Check the actor logs for any issues.

Limitations

  • Instagram may require login for some features (hashtag scraping, private profiles)
  • Instagram may implement rate limiting or CAPTCHA challenges for high-volume requests
  • The actor respects Instagram's structure and may need updates if Instagram changes their UI
  • Comments extraction requires additional page interactions and may slow down scraping
  • Maximum 1000 posts per run (configurable via maxPosts)
  • Private profiles cannot be scraped without authentication

Troubleshooting

No results found

  • Verify the username/hashtag/postUrl is correct
  • Check if the account is private (private accounts require login)
  • Try increasing wait times if pages load slowly

Missing data fields

  • Some posts may not have all fields (e.g., likes, comments)
  • Instagram structure may vary by region or account type
  • Check actor logs for extraction warnings

Scraping too slow

  • Reduce maxPosts
  • Disable includeComments if not needed
  • Check your internet connection and Apify platform resources
  • Consider using Apify Proxy for better performance

Login required

  • Some features require Instagram login
  • Hashtag scraping may show login prompts
  • Consider implementing authentication for full access

Changelog

Version 1.0.0

  • Initial release
  • Profile scraping
  • Post extraction
  • Hashtag scraping
  • Comments extraction support
  • Engagement metrics extraction

License

ISC

Support

For issues, questions, or contributions, please visit the actor's page on Apify Store.