Overview
TikTok Miner’s Instagram integration uses Apify’s Instagram scraper to collect comprehensive profile data, post metrics, and engagement analytics. This integration provides access to public Instagram data without requiring official API access.How It Works
The Instagram integration uses theActorManager class with specialized scraping methods:
- Profile Scraping: Collects account information, follower/following counts, bio, and verification status
- Post Analysis: Retrieves recent posts with likes, comments, and engagement data
- Discovery: Searches for creators by username, hashtag, or location
- Metrics Calculation: Computes engagement rates and audience quality scores
Architecture
- Actor Manager:
lib/apify/actor-manager.ts - Transformers:
lib/apify/transformers.ts - Configuration:
lib/apify/config.ts - Database Schema:
prisma/schema.prisma(InstagramMetrics model)
Configuration
Environment Variables
Service Setup
Data Collection
Profile Metrics
TheInstagramMetrics table stores:
| Field | Type | Description |
|---|---|---|
accountId | String | Instagram account ID |
username | String | Instagram username (unique) |
fullName | String | Display name |
followerCount | Int | Total followers |
followingCount | Int | Total following |
mediaCount | Int | Total posts |
averageLikes | Float | Average likes per post |
averageComments | Float | Average comments per post |
engagementRate | Float | Calculated engagement rate (%) |
isVerified | Boolean | Blue checkmark status |
isBusinessAccount | Boolean | Business account flag |
businessCategory | String | Business category (if applicable) |
reach | Int | Reach metric (business accounts) |
impressions | Int | Impressions (business accounts) |
profileViews | Int | Profile views (business accounts) |
websiteClicks | Int | Website clicks (business accounts) |
Data Model
Usage Examples
- Scrape Profile
- Calculate Engagement
- Search & Discover
- Store in Database
Rate Limits & Quotas
Apify Limits
- Free Tier: $5 in free credits monthly
- Personal Plan: $49/month with more compute units
- Default Timeout: 300 seconds per run
- Memory: 512 MB default (configurable up to 32 GB)
- Concurrent Runs: Based on subscription tier
Instagram Scraper Configuration
Cost Optimization
Post Scraping
Scrape Posts by Hashtag
Error Handling
Data Validation
TheInstagramTransformer ensures data quality:
- Username sanitization
- Bio HTML stripping
- URL normalization
- Numeric type validation
- Required field checks
Pipeline Discovery
Store discovered profiles for later processing:Monitoring
Track Data Quality
Set Up Alerts
Best Practices
Limitations
- Private Accounts: Cannot scrape private profiles
- Stories: Story data is not available via scraping
- Reels Insights: Limited reel metrics without Business API
- Real-time Data: Slight delay compared to official API
- Business Insights: Partial data; full insights require Graph API