Back to all posts

How to Scrape Facebook Video Data in 2026

Jonathan Geiger
Facebook APIVideo StatisticsData ExtractionFacebook ScrapingVideo Analytics

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

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

What Data Can You Extract?

The Facebook Stats API provides comprehensive video information:

  • Engagement Metrics - Views, likes, comments, and shares
  • Reaction Breakdown - Detailed counts for Like, Love, Care, Haha, Wow, and Sad reactions
  • Content Details - Video descriptions and captions
  • Author Information - Creator name and profile link
  • Video Metadata - Video ID and URL

The Easy Way: Facebook Stats API

The simplest and most reliable method is using the Facebook 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 Facebook changes
Fast & Reliable - Get video data in seconds with 99.9% uptime
Simple Integration - Just one API call with a Facebook video URL
Structured Data - Clean JSON response ready for your application

API Endpoint

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

Parameters

ParameterTypeRequiredDescription
urlstringYesFacebook video URL (Watch, Reels, or post with video)
access_keystringYesYour API access key

Example Request

GET https://api.socialkit.dev/facebook/stats?access_key=<your-access-key>&url=https://www.facebook.com/watch?v=876091671461782

Example Response

{
  "success": true,
  "data": {
    "url": "https://www.facebook.com/watch?v=876091671461782",
    "id": "876091671461782",
    "description": "Why was i waiting for him to get shot in the back n some guy run off with his guitar!?",
    "views": 2615704,
    "likes": 91856,
    "comments": 523,
    "shares": 0,
    "reactions": [
      { "name": "Like", "count": 79850, "formatted": "79K" },
      { "name": "Love", "count": 10897, "formatted": "10K" },
      { "name": "Care", "count": 881, "formatted": "881" },
      { "name": "Haha", "count": 174, "formatted": "174" },
      { "name": "Wow", "count": 44, "formatted": "44" },
      { "name": "Sad", "count": 10, "formatted": "10" }
    ],
    "author": "Elliottasalways",
    "authorLink": "https://www.facebook.com/241592216394061",
    "isVideo": true
  }
}

Code Examples

JavaScript / Node.js

const axios = require('axios');

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

// Usage
const videoUrl = 'https://www.facebook.com/watch?v=876091671461782';
const accessKey = 'your-access-key';

getFacebookVideoStats(videoUrl, accessKey)
  .then(data => {
    console.log('Author:', data.data.author);
    console.log('Views:', data.data.views.toLocaleString());
    console.log('Likes:', data.data.likes.toLocaleString());
    console.log('Comments:', data.data.comments.toLocaleString());
    console.log('Shares:', data.data.shares.toLocaleString());
    
    console.log('\nReaction Breakdown:');
    data.data.reactions.forEach(r => {
      console.log(`  ${r.name}: ${r.formatted}`);
    });
  });

Python

import requests

def get_facebook_video_stats(video_url, access_key):
    endpoint = 'https://api.socialkit.dev/facebook/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://www.facebook.com/watch?v=876091671461782'
access_key = 'your-access-key'

data = get_facebook_video_stats(video_url, access_key)

print(f"Author: {data['data']['author']}")
print(f"Views: {data['data']['views']:,}")
print(f"Likes: {data['data']['likes']:,}")
print(f"Comments: {data['data']['comments']:,}")
print(f"Shares: {data['data']['shares']:,}")

print("\nReaction Breakdown:")
for reaction in data['data']['reactions']:
    print(f"  {reaction['name']}: {reaction['formatted']}")

PHP

<?php

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

// Usage
$videoUrl = 'https://www.facebook.com/watch?v=876091671461782';
$accessKey = 'your-access-key';

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

echo "Author: " . $data['data']['author'] . "\n";
echo "Views: " . number_format($data['data']['views']) . "\n";
echo "Likes: " . number_format($data['data']['likes']) . "\n";
echo "Comments: " . number_format($data['data']['comments']) . "\n";
echo "Shares: " . number_format($data['data']['shares']) . "\n";

echo "\nReaction Breakdown:\n";
foreach ($data['data']['reactions'] as $reaction) {
    echo "  " . $reaction['name'] . ": " . $reaction['formatted'] . "\n";
}

cURL

curl -X GET "https://api.socialkit.dev/facebook/stats?access_key=your-access-key&url=https://www.facebook.com/watch?v=876091671461782"

Use Cases

1. Video Performance Tracking

Monitor video performance across your Facebook content:

const videos = [
  'https://www.facebook.com/watch?v=123',
  'https://www.facebook.com/watch?v=456',
  'https://www.facebook.com/watch?v=789'
];

async function analyzeVideoPerformance(videoUrls, accessKey) {
  const results = [];
  
  for (const url of videoUrls) {
    const data = await getFacebookVideoStats(url, accessKey);
    
    const totalReactions = data.data.reactions.reduce((sum, r) => sum + r.count, 0);
    const engagementRate = ((totalReactions + data.data.comments) / data.data.views * 100).toFixed(2);
    
    results.push({
      url: url,
      author: data.data.author,
      views: data.data.views,
      totalReactions: totalReactions,
      comments: data.data.comments,
      shares: data.data.shares,
      engagementRate: `${engagementRate}%`
    });
  }
  
  return results.sort((a, b) => b.views - a.views);
}

2. Reaction Analysis

Analyze the sentiment distribution through reactions:

def analyze_reaction_sentiment(video_url, access_key):
    data = get_facebook_video_stats(video_url, access_key)
    
    reactions = {r['name']: r['count'] for r in data['data']['reactions']}
    total = sum(reactions.values())
    
    if total == 0:
        return {'error': 'No reactions found'}
    
    # Categorize reactions
    positive = reactions.get('Like', 0) + reactions.get('Love', 0) + reactions.get('Care', 0)
    neutral = reactions.get('Haha', 0) + reactions.get('Wow', 0)
    negative = reactions.get('Sad', 0) + reactions.get('Angry', 0)
    
    return {
        'video_url': video_url,
        'total_reactions': total,
        'sentiment_breakdown': {
            'positive': f"{(positive/total*100):.1f}%",
            'neutral': f"{(neutral/total*100):.1f}%",
            'negative': f"{(negative/total*100):.1f}%"
        },
        'dominant_reaction': max(reactions, key=reactions.get),
        'reaction_details': reactions
    }

3. Competitive Analysis

Compare your content performance against competitors:

async function compareWithCompetitors(yourVideos, competitorVideos, accessKey) {
  const yourStats = await Promise.all(
    yourVideos.map(url => getFacebookVideoStats(url, accessKey))
  );
  
  const competitorStats = await Promise.all(
    competitorVideos.map(url => getFacebookVideoStats(url, accessKey))
  );
  
  const yourAvgViews = yourStats.reduce((sum, s) => sum + s.data.views, 0) / yourStats.length;
  const compAvgViews = competitorStats.reduce((sum, s) => sum + s.data.views, 0) / competitorStats.length;
  
  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: {
      avgViews: Math.round(yourAvgViews),
      avgLikes: Math.round(yourAvgLikes),
      avgComments: Math.round(yourStats.reduce((sum, s) => sum + s.data.comments, 0) / yourStats.length)
    },
    competitorPerformance: {
      avgViews: Math.round(compAvgViews),
      avgLikes: Math.round(compAvgLikes),
      avgComments: Math.round(competitorStats.reduce((sum, s) => sum + s.data.comments, 0) / competitorStats.length)
    },
    comparison: yourAvgViews > compAvgViews ? 'outperforming' : 'underperforming'
  };
}

4. Viral Content Detection

Identify viral videos based on engagement metrics:

def detect_viral_content(video_urls, access_key, viral_threshold=100000):
    """Detect videos that have gone viral"""
    
    viral_videos = []
    
    for url in video_urls:
        data = get_facebook_video_stats(url, access_key)
        
        views = data['data']['views']
        likes = data['data']['likes']
        
        # Calculate virality score
        engagement = likes + data['data']['comments'] + data['data']['shares']
        virality_score = (views * 0.5) + (engagement * 2)
        
        if views >= viral_threshold or virality_score >= viral_threshold:
            viral_videos.append({
                'url': url,
                'views': views,
                'likes': likes,
                'comments': data['data']['comments'],
                'shares': data['data']['shares'],
                'virality_score': int(virality_score),
                'status': 'VIRAL' if views >= viral_threshold * 2 else 'TRENDING'
            })
    
    return sorted(viral_videos, key=lambda x: x['virality_score'], reverse=True)

Response Data Explained

Content Information

  • url - The Facebook video URL
  • id - Unique video identifier
  • description - Video caption/description
  • isVideo - Boolean confirming it's a video

Engagement Metrics

  • views - Total view count
  • likes - Total like reactions
  • comments - Number of comments
  • shares - Number of shares

Reaction Breakdown

  • reactions - Array of reaction objects with:
    • name - Reaction type (Like, Love, Care, Haha, Wow, Sad)
    • count - Raw count
    • formatted - Formatted count (e.g., "79K")

Author Information

  • author - Page/creator name
  • authorLink - Direct link to creator's page

Calculating Engagement Rate

const totalReactions = reactions.reduce((sum, r) => sum + r.count, 0);
const engagementRate = ((totalReactions + comments + shares) / views * 100).toFixed(2);

Supported URL Formats

The API accepts various Facebook video URL formats:

  • https://www.facebook.com/watch?v=VIDEO_ID
  • https://facebook.com/watch?v=VIDEO_ID
  • https://www.facebook.com/reel/REEL_ID
  • https://www.facebook.com/PAGE_NAME/videos/VIDEO_ID
  • https://fb.watch/SHORT_CODE

Error Handling

Always implement proper error handling in production:

async function getFacebookVideoStatsWithRetry(videoUrl, accessKey, maxRetries = 3) {
  for (let i = 0; i < maxRetries; i++) {
    try {
      const response = await axios.get('https://api.socialkit.dev/facebook/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 Facebook Video Data Extractor - no API key required!

Pricing

The Facebook 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: $95/month (50,000 credits)

Each API request costs 1 credit. View full pricing →

Alternative: Build Your Own Scraper

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

Challenges

  1. Anti-Bot Protection - Facebook 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 - Facebook regularly updates their HTML structure
  5. Legal Risks - Scraping may violate Facebook'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 Facebook changes
  • Scale - Process thousands of videos without proxy management
  • Legal - Using compliant APIs reduces legal risk
  • Time - Focus on building features, not fighting anti-bot systems

Complete Facebook & Social Media Data Toolkit

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

Facebook APIs:

Free Facebook Tools:

Frequently Asked Questions

Can I get all video data from a Facebook page?

The API works per-video. To get data for multiple videos, you'll need to make separate API calls for each video URL.

Can I scrape private videos?

No, the API only works with public Facebook videos. Private videos cannot be accessed.

How accurate is the data?

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

Does it work with Facebook Reels?

Yes! The Facebook Stats API works with Facebook Watch videos, Reels, and video posts.

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.