Back to all posts

How to Scrape Instagram Video Data - The Easy Way

Jonathan Geiger
Instagram APIVideo StatisticsData ExtractionInstagram ScrapingReels Analytics

Need to extract Instagram video statistics programmatically? Whether you're building social media analytics tools, content performance dashboards, or engagement tracking platforms, getting reliable Instagram video data is essential.

In this guide, we'll show you the easiest way to scrape Instagram video data using the Instagram Stats API - no complex scraping infrastructure required.

What Data Can You Extract?

The Instagram Stats API provides comprehensive video information for Instagram posts and reels:

  • Engagement Metrics - Likes, comments, and view counts
  • Content Details - Video descriptions, captions, and hashtags
  • Author Information - Username, profile link, and creator data
  • Media Details - Duration, thumbnail URL, and video URL
  • Performance Data - Engagement rates and content analytics

The Easy Way: Instagram Stats API

The simplest and most reliable method is using the Instagram Stats API. Here's why:

No Infrastructure Needed - No need to manage proxies, browsers, or anti-bot systems
Always Up-to-Date - API automatically handles Instagram changes
Fast & Reliable - Get video data in seconds with 99.9% uptime
Simple Integration - Just one API call with an Instagram video URL
Structured Data - Clean JSON response ready for your application

API Endpoint

https://api.socialkit.dev/instagram/stats

Parameters

ParameterTypeRequiredDescription
urlstringYesInstagram post or reel URL (e.g., https://instagram.com/p/ABC123/ or https://instagram.com/reel/XYZ789/)
access_keystringYesYour API access key

Example Request

GET https://api.socialkit.dev/instagram/stats?access_key=<your-access-key>&url=https://instagram.com/reel/DRU4smMj0cu/

Example Response

{
  "success": true,
  "data": {
    "url": "https://www.instagram.com/p/DRU4smMj0cu/",
    "description": ".\n.\n.\n.\n.\n.\n#cat #catsoftheworld #catsoftheday #catsgram #pet #petlovers #petlover #petsofinstagram #funny #funnyvideos #cute #cutecats #kitten #kittenlove #kittycat #reels",
    "likes": 34209,
    "comments": 169,
    "author": "yuumi_cat9",
    "authorLink": "https://www.instagram.com/yuumi_cat9/",
    "duration": "0:27",
    "thumbnail": "https://scontent-iad3-1.cdninstagram.com/v/t51.71878-15/583855550_1629099614919809_395573344085568572_n.jpg"
  }
}

Code Examples

JavaScript / Node.js

const axios = require('axios');

async function getInstagramVideoStats(videoUrl, accessKey) {
  try {
    const response = await axios.get('https://api.socialkit.dev/instagram/stats', {
      params: {
        access_key: accessKey,
        url: videoUrl
      }
    });
    
    return response.data;
  } catch (error) {
    console.error('Error fetching Instagram video stats:', error);
    throw error;
  }
}

// Usage
const videoUrl = 'https://instagram.com/reel/DRU4smMj0cu/';
const accessKey = 'your-access-key';

getInstagramVideoStats(videoUrl, accessKey)
  .then(data => {
    console.log('Author:', data.data.author);
    console.log('Likes:', data.data.likes.toLocaleString());
    console.log('Comments:', data.data.comments.toLocaleString());
    console.log('Duration:', data.data.duration);
  });

Python

import requests

def get_instagram_video_stats(video_url, access_key):
    endpoint = 'https://api.socialkit.dev/instagram/stats'
    
    params = {
        'access_key': access_key,
        'url': video_url
    }
    
    response = requests.get(endpoint, params=params)
    response.raise_for_status()
    
    return response.json()

# Usage
video_url = 'https://instagram.com/reel/DRU4smMj0cu/'
access_key = 'your-access-key'

data = get_instagram_video_stats(video_url, access_key)

print(f"Author: {data['data']['author']}")
print(f"Likes: {data['data']['likes']:,}")
print(f"Comments: {data['data']['comments']:,}")
print(f"Duration: {data['data']['duration']}")

PHP

<?php

function getInstagramVideoStats($videoUrl, $accessKey) {
    $endpoint = 'https://api.socialkit.dev/instagram/stats';
    
    $url = $endpoint . '?' . http_build_query([
        'access_key' => $accessKey,
        'url' => $videoUrl
    ]);
    
    $response = file_get_contents($url);
    return json_decode($response, true);
}

// Usage
$videoUrl = 'https://instagram.com/reel/DRU4smMj0cu/';
$accessKey = 'your-access-key';

$data = getInstagramVideoStats($videoUrl, $accessKey);

echo "Author: " . $data['data']['author'] . "\n";
echo "Likes: " . number_format($data['data']['likes']) . "\n";
echo "Comments: " . number_format($data['data']['comments']) . "\n";
echo "Duration: " . $data['data']['duration'] . "\n";

cURL

curl -X GET "https://api.socialkit.dev/instagram/stats?access_key=your-access-key&url=https://instagram.com/reel/DRU4smMj0cu/"

Use Cases

1. Influencer Performance Tracking

Monitor Instagram creators' video performance to identify top performers:

const videos = [
  'https://instagram.com/reel/ABC123/',
  'https://instagram.com/reel/DEF456/',
  'https://instagram.com/reel/GHI789/'
];

async function analyzeInfluencerContent(videoUrls, accessKey) {
  const results = [];
  
  for (const url of videoUrls) {
    const data = await getInstagramVideoStats(url, accessKey);
    
    results.push({
      url: url,
      author: data.data.author,
      likes: data.data.likes,
      comments: data.data.comments,
      engagementRate: ((data.data.likes + data.data.comments) / data.data.likes * 100).toFixed(2)
    });
  }
  
  return results.sort((a, b) => b.likes - a.likes);
}

2. Content Performance Dashboard

Track video performance metrics across your Instagram content:

import time
from datetime import datetime

def track_video_performance(video_urls, access_key):
    """Track video performance over time"""
    
    performance_data = []
    
    for url in video_urls:
        data = get_instagram_video_stats(url, access_key)
        
        stats = {
            'timestamp': datetime.now().isoformat(),
            'url': url,
            'author': data['data']['author'],
            'likes': data['data']['likes'],
            'comments': data['data']['comments'],
            'engagement': data['data']['likes'] + data['data']['comments']
        }
        
        performance_data.append(stats)
    
    return performance_data

3. Competitive Analysis

Compare your content performance against competitors:

async function compareWithCompetitors(yourVideos, competitorVideos, accessKey) {
  const yourStats = await Promise.all(
    yourVideos.map(url => getInstagramVideoStats(url, accessKey))
  );
  
  const competitorStats = await Promise.all(
    competitorVideos.map(url => getInstagramVideoStats(url, accessKey))
  );
  
  const yourAvgLikes = yourStats.reduce((sum, s) => sum + s.data.likes, 0) / yourStats.length;
  const compAvgLikes = competitorStats.reduce((sum, s) => sum + s.data.likes, 0) / competitorStats.length;
  
  return {
    yourPerformance: {
      avgLikes: yourAvgLikes,
      avgComments: yourStats.reduce((sum, s) => sum + s.data.comments, 0) / yourStats.length
    },
    competitorPerformance: {
      avgLikes: compAvgLikes,
      avgComments: competitorStats.reduce((sum, s) => sum + s.data.comments, 0) / competitorStats.length
    },
    comparison: yourAvgLikes > compAvgLikes ? 'outperforming' : 'underperforming'
  };
}

4. Engagement Rate Calculator

Calculate and track engagement rates for influencer campaigns:

def calculate_engagement_rate(video_url, access_key, follower_count):
    data = get_instagram_video_stats(video_url, access_key)
    
    likes = data['data']['likes']
    comments = data['data']['comments']
    
    total_engagement = likes + comments
    engagement_rate = (total_engagement / follower_count * 100) if follower_count > 0 else 0
    
    return {
        'author': data['data']['author'],
        'likes': likes,
        'comments': comments,
        'total_engagement': total_engagement,
        'engagement_rate': f"{engagement_rate:.2f}%",
        'performance': 'High' if engagement_rate > 3 else 'Medium' if engagement_rate > 1 else 'Low'
    }

Response Data Explained

Content Information

  • url - The Instagram post or reel URL
  • description - Caption text and hashtags
  • duration - Video length in MM:SS format
  • thumbnail - High-quality thumbnail image URL

Engagement Metrics

  • likes - Total like count
  • comments - Number of comments

Author Information

  • author - Instagram username of the creator
  • authorLink - Direct link to creator's profile

Calculating Engagement Rate

const engagementRate = ((likes + comments) / followerCount * 100).toFixed(2);

Supported URL Formats

The API accepts various Instagram URL formats:

  • https://www.instagram.com/p/POST_ID/
  • https://instagram.com/p/POST_ID/
  • https://www.instagram.com/reel/REEL_ID/
  • https://instagram.com/reel/REEL_ID/
  • https://www.instagram.com/p/POST_ID/?igsh=... (URLs with query parameters)

Error Handling

Always implement proper error handling in production:

async function getInstagramVideoStatsWithRetry(videoUrl, accessKey, maxRetries = 3) {
  for (let i = 0; i < maxRetries; i++) {
    try {
      const response = await axios.get('https://api.socialkit.dev/instagram/stats', {
        params: { access_key: accessKey, url: videoUrl }
      });
      
      if (response.data.success) {
        return response.data;
      }
      
      throw new Error('API returned unsuccessful response');
    } catch (error) {
      console.error(`Attempt ${i + 1} failed:`, error.message);
      
      if (i === maxRetries - 1) {
        throw error;
      }
      
      // Wait before retrying (exponential backoff)
      await new Promise(resolve => setTimeout(resolve, Math.pow(2, i) * 1000));
    }
  }
}

Try It Free

Want to test the API before integrating? Try our Free Instagram Video Data Extractor - no API key required!

Pricing

The Instagram Stats API is included in all SocialKit plans:

  • Free: 20 credits (20 video lookups)
  • Basic: $13/month (2,000 credits)
  • Pro: $27/month (10,000 credits)
  • Ultimate: $79/month (50,000 credits)

Each API request costs 1 credit. View full pricing →

Alternative: Build Your Own Scraper

Want to build your own Instagram scraper? It's possible but complex:

Challenges

  1. Anti-Bot Protection - Instagram uses sophisticated bot detection
  2. Dynamic Content - Requires JavaScript rendering with Puppeteer/Selenium
  3. IP Blocking - Need rotating proxies to avoid rate limits
  4. Frequent Changes - Instagram regularly updates their HTML structure
  5. Legal Risks - Scraping may violate Instagram's Terms of Service
  6. Login Requirements - Many features require authentication

Why Use an API Instead?

  • Reliability - APIs handle all the complexity for you
  • Maintenance - No need to update selectors when Instagram changes
  • Scale - Process thousands of videos without proxy management
  • Legal - Using official or compliant APIs reduces legal risk
  • Time - Focus on building features, not fighting anti-bot systems

Complete Instagram & Social Media Data Toolkit

Beyond video statistics, you might need other social media data:

Instagram APIs:

TikTok APIs:

YouTube APIs:

Free Instagram Tools:

Frequently Asked Questions

Can I get Instagram video view counts?

Instagram's public data access is limited. The API returns publicly available metrics like likes and comments. View counts may not be available for all videos.

Can I scrape private accounts?

No, the API only works with public Instagram profiles and videos. Private accounts cannot be accessed.

How accurate is the data?

The API returns data directly from Instagram, so it's as accurate as what Instagram displays publicly.

Does it work with both posts and reels?

Yes! The Instagram Stats API works with both regular Instagram posts and Instagram Reels.

What's the rate limit?

Rate limits depend on your plan. All plans use a credit-based system where each API request costs 1 credit.