Facebook Scraper API: Extract Public Facebook Data
Need Facebook data for research or analysis? This guide shows you how to scrape pages, posts, groups, and comments using SociaVault's Facebook API.
Facebook API Endpoints
| Endpoint | Description |
|---|---|
| Profile | Get page/profile info |
| Profile Posts | Get posts from a page |
| Group Posts | Get posts from a group |
| Post | Get single post details |
| Post Transcript | Video transcript |
| Post Comments | Get post comments |
Profile/Page Scraper
Get Facebook page or profile information:
const response = await fetch('https://api.sociavault.com/facebook/profile', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
url: 'https://www.facebook.com/Meta'
})
});
const page = await response.json();
Response
{
"id": "123456789",
"name": "Meta",
"username": "Meta",
"about": "Meta builds technologies that help people connect...",
"followers": 15000000,
"likes": 14500000,
"category": "Technology Company",
"website": "https://about.meta.com",
"profilePicture": "https://...",
"coverPhoto": "https://...",
"verified": true
}
Profile Posts Scraper
Get posts from a Facebook page:
const response = await fetch('https://api.sociavault.com/facebook/profile/posts', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
url: 'https://www.facebook.com/Meta'
})
});
const posts = await response.json();
Response
{
"posts": [
{
"id": "123456789_987654321",
"text": "Introducing our latest innovation...",
"likes": 25000,
"comments": 1500,
"shares": 3200,
"createdAt": "2026-01-08T10:00:00Z",
"media": [
{
"type": "image",
"url": "https://..."
}
],
"link": null,
"isVideo": false,
"isReel": false
}
],
"hasMore": true,
"cursor": "next_page"
}
Group Posts Scraper
Extract posts from public Facebook groups:
const response = await fetch('https://api.sociavault.com/facebook/group/posts', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
url: 'https://www.facebook.com/groups/groupname'
})
});
const groupPosts = await response.json();
Single Post Details
Get detailed information about a specific post:
const response = await fetch('https://api.sociavault.com/facebook/post', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
url: 'https://www.facebook.com/Meta/posts/123456789'
})
});
const post = await response.json();
Video Transcript
Extract speech-to-text from Facebook videos and Reels:
const response = await fetch('https://api.sociavault.com/facebook/post/transcript', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
url: 'https://www.facebook.com/reel/123456789'
})
});
const transcript = await response.json();
Post Comments
Get comments from any Facebook post:
const response = await fetch('https://api.sociavault.com/facebook/post/comments', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
url: 'https://www.facebook.com/Meta/posts/123456789'
})
});
const comments = await response.json();
Comments Response
{
"comments": [
{
"id": "comment_123",
"text": "This is amazing! 🔥",
"author": {
"name": "John Doe",
"profileUrl": "https://..."
},
"likes": 150,
"replies": 12,
"createdAt": "2026-01-08T11:30:00Z"
}
],
"totalComments": 1500,
"hasMore": true
}
Use Cases
Competitor Monitoring
Track competitor Facebook activity:
async function monitorCompetitor(pageUrl) {
const page = await getProfile(pageUrl);
const { posts } = await getProfilePosts(pageUrl);
const avgEngagement = posts.reduce((s, p) =>
s + p.likes + p.comments + p.shares, 0
) / posts.length;
return {
page: page.name,
followers: page.followers,
recentPosts: posts.length,
avgEngagement,
engagementRate: (avgEngagement / page.followers * 100).toFixed(3) + '%'
};
}
Group Research
Analyze discussions in Facebook groups:
async function analyzeGroup(groupUrl) {
const { posts } = await getGroupPosts(groupUrl);
// Find hot topics
const topics = {};
posts.forEach(post => {
const words = post.text.toLowerCase().split(/\s+/);
words.forEach(w => {
if (w.length > 4) topics[w] = (topics[w] || 0) + 1;
});
});
const trending = Object.entries(topics)
.sort((a, b) => b[1] - a[1])
.slice(0, 20);
return trending;
}
Sentiment Analysis
Analyze comment sentiment:
async function analyzePostSentiment(postUrl) {
const { comments } = await getPostComments(postUrl);
const positive = comments.filter(c =>
c.text.match(/love|great|amazing|awesome/i)
).length;
const negative = comments.filter(c =>
c.text.match(/hate|bad|terrible|awful/i)
).length;
return {
positive: (positive / comments.length * 100).toFixed(1) + '%',
negative: (negative / comments.length * 100).toFixed(1) + '%'
};
}
Related Endpoints
- Facebook Ad Library - Ad research
- Instagram Scraper - Instagram data
- LinkedIn Scraper - LinkedIn data
Frequently Asked Questions
Can I scrape private groups?
No, only public groups are accessible. Private groups require membership.
Are Facebook Reels supported?
Yes, Reels are supported through the Post and Post Transcript endpoints.
How far back can I get posts?
You can access historical posts through pagination, going back months or years depending on the page's posting history.
Can I get personal profile data?
The API focuses on public pages and groups. Personal profiles have stricter privacy controls.
Is this compliant with Facebook's terms?
SociaVault accesses publicly available data. Always use data responsibly and ethically.
Get Started
Sign up free and start extracting Facebook data.
Documentation: /docs/api-reference/facebook/profile
Found this helpful?
Share it with others who might benefit
Ready to Try SociaVault?
Start extracting social media data with our powerful API. No credit card required.