
Facebook Page Posts
- 3 installs
- 5.2k repo stars
- Updated July 21, 2026
- browser-act/skills
Facebook Page Posts Scraper is a Claude skill that scrapes a public Facebook Page timeline for post text, author, and engagement metrics via authenticated browser automation.
About
This skill scrapes posts from a public Facebook Page timeline. Each post returns text, author info, engagement metrics (likes, comments, shares), reaction breakdowns, hashtags and external links, and media type. It resolves a page URL to a numeric page ID, then fetches posts with date-range filtering and cursor pagination. It requires being logged into Facebook and is used for page monitoring and social analytics.
- Scrapes public Facebook Page timeline posts with text, author, and engagement metrics
- Returns full reaction breakdown (like/love/haha/wow/sad/angry/care), hashtags, and external links
- Supports date-range filtering (afterTime/beforeTime) and cursor-based pagination
Facebook Page Posts by the numbers
- 3 all-time installs (skills.sh)
- Ranked #1,816 of 2,715 Automation & Workflows skills by installs in the Skillselion catalog
- Data as of Aug 5, 2026 (Skillselion catalog sync)
facebook-page-posts capabilities & compatibility
Free; needs the browser-act tool and a logged-in Facebook session, no API key
- Capabilities
- facebook page profile posts · facebook groups scrape posts · facebook ads library search
- Use cases
- web scraping · data analysis · research
- Pricing
- Free
What facebook-page-posts says it does
Extract posts from a public Facebook Page timeline, including post content, engagement counts, reaction breakdowns, and text references (hashtags/links).
User is logged into Facebook (user avatar visible in the top right)
Resolve Facebook page URL to numeric page ID
npx skills add https://github.com/browser-act/skills --skill facebook-page-postsAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 3 |
|---|---|
| repo stars | ★ 5.2k |
| Last updated | July 21, 2026 |
| Repository | browser-act/skills ↗ |
What it does
Scrape a public Facebook Page timeline for post content and engagement metrics with date-range filtering.
Who is it for?
Monitoring a public Facebook Page and collecting post engagement data
Skip if: Unauthenticated scraping; the user must be logged into Facebook
When should I use this skill?
You need posts and engagement metrics from a public Facebook Page timeline
What you get
A paginated list of page posts with text, engagement counts, and reaction breakdowns.
- Paginated page posts with text, engagement counts, reaction breakdown, hashtags, links
By the numbers
- Full reaction breakdown across 7 reaction types
- Default 5 posts per batch (max recommended 10)
Files
Facebook — Page Posts Scraper
Facebook page URL → list of posts with full engagement metrics and text references
Language
All process output to user (progress updates, process notifications) must be in English.
Objective
Extract posts from a public Facebook Page timeline, including post content, engagement counts, reaction breakdowns, and text references (hashtags/links).
Prerequisites
- The target Facebook page is open in the browser (e.g.,
https://www.facebook.com/cern) - User is logged into Facebook (user avatar visible in the top right)
Pre-execution Checks
1. Tool Readiness
If browser-act has been confirmed available in the current session → skip this step.
Invoke browser-act via Skill tool to load usage. If installation or configuration issues arise, follow its guidance to resolve then retry.
2. Login Verification
If login status for Facebook has been confirmed in the current session → skip this step.
Otherwise: navigate to https://www.facebook.com and check:
- User avatar or name visible in top right → logged in, continue
- Login button visible → not logged in, inform the user and assist with login
User refuses or cannot log in → terminate execution.
Capability Components
This Skill's operational boundary = what the user can manually do in their browser. It only reads data already displayed to the user on the page, never bypassing authentication or access controls. JS code is encapsulated in Python files under thescripts/directory, invoked viaeval "$(python scripts/xxx.py {params})".$(...)is bash syntax; it is recommended to use the bash tool for execution.
API: Resolve Facebook page URL to numeric page ID
eval "$(python scripts/get-page-id.py '{page_url}')"
Parameters:
page_url: Full Facebook page URL, e.g.https://www.facebook.com/cern
Must run while the target page is open (or any Facebook page is open) so the browser has Facebook cookies.
Output example:
{
"pageId": "100064792144187", // Numeric page ID used in all subsequent API calls
"pageUrl": "https://www.facebook.com/cern"
}API: Fetch posts from page timeline
eval "$(python scripts/get-page-posts.py '{page_id}' --cursor '{cursor}' --after-time {after_time} --before-time {before_time} --count {count})"
Parameters:
page_id: Numeric Facebook page ID (from get-page-id above)--cursor: Pagination cursor string from previous responsepagination.endCursor; omit or passnullfor first page--after-time: Unix timestamp (seconds); only return posts after this time; omit or passnullfor no filter--before-time: Unix timestamp (seconds); only return posts before this time; omit or passnullfor no filter--count: Number of posts per batch, default5, max recommended10
Output example:
{
"posts": [
{
"postId": "1417704873732571", // Numeric post ID
"url": "https://www.facebook.com/cern/posts/pfbid…", // Post permalink
"text": "CERN Council updates European Strategy…", // Full post text
"textReferences": [
{
"type": "ExternalUrl", // "ExternalUrl" or "Hashtag"
"url": "https://home.cern/...", // Clean URL (not l.facebook.com redirect)
"offset": 731, // Position in text
"length": 96
},
{
"type": "Hashtag",
"url": "https://www.facebook.com/hashtag/espp",
"offset": 296,
"length": 5
}
],
"creationTime": 1779460218, // Unix timestamp (seconds)
"user": {
"id": "100064792144187", // Page numeric ID
"name": "CERN", // Page display name
"profileUrl": "https://www.facebook.com/cern" // Page URL
},
"likes": 1220, // Total reactions count
"comments": 44, // Comment count
"shares": 122, // Share count
"topReactions": [
{ "name": "Like", "count": 1108 },
{ "name": "Love", "count": 92 },
{ "name": "Care", "count": 9 },
{ "name": "Wow", "count": 8 },
{ "name": "Haha", "count": 1 },
{ "name": "Sad", "count": 1 },
{ "name": "Angry", "count": 1 }
],
"topReactionsCount": 1220, // Same as likes, total reactions
"media": {
"type": "Photo", // "Photo", "Video", or null for text-only
"id": "photo_id_string", // Media asset ID
"viewsCount": null // Video view count; null for photos
},
"feedbackId": "ZmVlZGJhY2s6MTQxNzcw…" // Base64 feedback ID
}
],
"pagination": {
"endCursor": "Cg8Ob3JnYW5pY19jd…", // Pass to --cursor for next page
"hasNextPage": true // false when no more posts
}
}Error handling: If response contains "error": true, check that the target page is open and the user is logged in, then retry once. If the error persists, the doc_id may have expired — check experience notes for updates.
Pagination
API Pagination: cursor-based. Pass pagination.endCursor from each response as --cursor in the next call. Start value: omit --cursor (first page). Termination: pagination.hasNextPage === false.
Success Criteria
posts.length >= 1 AND posts[0].postId is non-null AND posts[0].likes is non-null
Known Limitations
media.idis returned but media thumbnail/photo URLs are not included in the API response for this query; only type and ID are availableviewsCountis only populated for Video-type attachments; null for photosfeedbackIdis present but detailed reaction dialog data (individual reactor profiles) requires a separate API call not covered by this Skill- The
doc_id: 27278869228466784is a Facebook internal query ID that may change when Facebook deploys updates; if all calls return errors, the doc_id may need to be recaptured via HAR recording on the page - Requires an active Facebook login session; public/unauthenticated access is not supported
- Date filtering (
afterTime/beforeTime) applies to the timeline cursor position, not a strict server-side filter; posts near the boundary may occasionally appear outside the specified range
Execution Efficiency
- Batch orchestration: Write a bash script to loop through the command templates serially within a single session; do not parallelize within one browser (prone to triggering anti-scraping restrictions). Add a 1–2 second delay between paginated calls to avoid rate limiting. To increase throughput, open multiple browser sessions and distribute work across them — each session has an independent fingerprint so rate limits apply per session
- Test before batch execution: After writing a batch script, you must first test with 1-2 items to verify the script runs correctly; only then run the full batch. Never skip testing and execute in batch directly
- Reduce redundant pre-operations: Run
get-page-idonce per page URL and reuse the result for all paginated calls - Error resumption: Save results page by page during batch processing; on failure, resume from the last successful
endCursorrather than starting over
Experience Notes
Path: {working-directory}/browser-act-skill-forge-memories/facebook-posts-scraper-facebook-page-posts.memory.md
Before execution: If the file exists, read it first — it records unexpected situations encountered during past executions (e.g., a strategy has become ineffective); adjust strategy order accordingly.
After execution: If an unexpected situation is encountered (strategy became ineffective, page redesigned, anti-scraping upgraded, better path discovered), append a line: {YYYY-MM-DD}: {what happened} → {conclusion}
Normal execution does not write to the file. Do not record what keywords were used or how many results were returned — those are task outputs, not experience.
import argparse
import sys
def main():
sys.stdout.reconfigure(encoding='utf-8', newline='\n')
parser = argparse.ArgumentParser()
parser.add_argument('page_url') # Facebook page URL, e.g. https://www.facebook.com/cern
args = parser.parse_args()
js = f"""
(async function() {{
try {{
const pageUrl = {repr(args.page_url)};
const r = await fetch(pageUrl);
const html = await r.text();
const m = html.match(/userID[^0-9]*(\\d{{12,18}})/);
if (!m) return JSON.stringify({{ error: true, message: 'Could not find page numeric ID in HTML. The page may require login or the URL may be invalid.' }});
return JSON.stringify({{ pageId: m[1], pageUrl: pageUrl }});
}} catch(e) {{
return JSON.stringify({{ error: true, message: e.message }});
}}
}})()
"""
print(js)
if __name__ == '__main__':
main()
import argparse
import sys
def main():
sys.stdout.reconfigure(encoding='utf-8', newline='\n')
parser = argparse.ArgumentParser()
parser.add_argument('page_id') # Numeric Facebook page ID
parser.add_argument('--cursor', default='null') # Pagination cursor (null for first page)
parser.add_argument('--after-time', default='null') # Unix timestamp: only posts after this time
parser.add_argument('--before-time', default='null') # Unix timestamp: only posts before this time
parser.add_argument('--count', default='5') # Number of posts per batch (1-10)
args = parser.parse_args()
cursor_val = 'null' if args.cursor == 'null' else repr(args.cursor)
after_val = args.after_time if args.after_time == 'null' else args.after_time
before_val = args.before_time if args.before_time == 'null' else args.before_time
js = f"""
(async function() {{
try {{
const fbDtsg = require('DTSGInitData')?.token || '';
let lsd = '';
const allScripts = Array.from(document.querySelectorAll('script')).map(s => s.textContent).join('');
const lsdM = allScripts.match(/"LSD"[^}}]*"token":"([^"]+)"/);
if (lsdM) lsd = lsdM[1];
const variables = {{
afterTime: {after_val},
beforeTime: {before_val},
count: {args.count},
cursor: {cursor_val},
feedLocation: 'TIMELINE',
feedbackSource: 0,
focusCommentID: null,
memorializedSplitTimeFilter: null,
omitPinnedPost: true,
postedBy: {{ group: 'OWNER' }},
privacy: null,
privacySelectorRenderLocation: 'COMET_STREAM',
referringStoryRenderLocation: null,
renderLocation: 'timeline',
scale: 1,
stream_count: 1,
taggedInOnly: null,
trackingCode: null,
useDefaultActor: false,
id: '{args.page_id}',
'__relay_internal__pv__GHLShouldChangeAdIdFieldNamerelayprovider': true,
'__relay_internal__pv__GHLShouldChangeSponsoredDataFieldNamerelayprovider': true,
'__relay_internal__pv__IsWorkUserrelayprovider': false,
'__relay_internal__pv__IsMergQAPollsrelayprovider': false,
'__relay_internal__pv__FBReelsEnableVideoWindowedReplayrelayprovider': false,
'__relay_internal__pv__StoriesArmadilloReplyEnabledrelayprovider': false,
'__relay_internal__pv__EventCometCardImage_prefetchEventImagerelayprovider': false,
'__relay_internal__pv__FBReelsMediaFooter_comet_enable_reels_ads_gkrelayprovider': false,
'__relay_internal__pv__CometUFIReactionsEnableShortNamerelayprovider': false,
'__relay_internal__pv__CometUFIShareActionMigrationrelayprovider': true,
'__relay_internal__pv__IncludeCommentWithAttachmentrelayprovider': true,
'__relay_internal__pv__GHLShouldUpdateVideoPreviewImagerelayprovider': false,
'__relay_internal__pv__GHLVideoTimestampOnShortsrelayprovider': false,
'__relay_internal__pv__CometFeedStoryDangerouslySetInnerFeedItemDisplayContentrelayprovider': false,
'__relay_internal__pv__StoriesRingrelayprovider': false,
'__relay_internal__pv__UseCometRouter_cometRouterrelayprovider': false,
'__relay_internal__pv__FBReelsFeedbackActionsrelayprovider': false,
'__relay_internal__pv__FBReelsMediaFooter_comet_enable_reels_ads_gkv2relayprovider': false,
'__relay_internal__pv__GHLShouldChangeSponsoredDataFieldNameForFeedV2relayprovider': true,
'__relay_internal__pv__GHLShouldChangeAdIdFieldNameForFeedV2relayprovider': true
}};
const body = new URLSearchParams({{
fb_dtsg: fbDtsg,
lsd: lsd,
variables: JSON.stringify(variables),
doc_id: '27278869228466784',
server_timestamps: 'true',
fb_api_caller_class: 'RelayModern',
fb_api_req_friendly_name: 'ProfileCometTimelineFeedRefetchQuery'
}});
const resp = await fetch('https://www.facebook.com/api/graphql/', {{
method: 'POST',
headers: {{
'Content-Type': 'application/x-www-form-urlencoded',
'X-FB-LSD': lsd
}},
body: body.toString()
}});
if (!resp.ok) return JSON.stringify({{ error: true, message: 'HTTP ' + resp.status }});
const text = await resp.text();
const lines = text.split('\\n').filter(l => l.trim().startsWith('{{'));
if (lines.length < 2) return JSON.stringify({{ error: true, message: 'Unexpected response format', raw: text.slice(0, 200) }});
function getUFI(node) {{
return node?.comet_sections?.feedback?.story?.story_ufi_container?.story
?.feedback_context?.feedback_target_with_context
?.comet_ufi_summary_and_actions_renderer?.feedback;
}}
function extractPost(node) {{
if (!node || !node.post_id) return null;
const ufi = getUFI(node);
const renderers = ufi?.adaptive_ufi_action_renderers;
const msg = node?.comet_sections?.content?.story?.comet_sections?.message?.story?.message
|| node?.comet_sections?.content?.story?.message;
const ranges = msg?.ranges?.map(r => ({{
type: r.entity?.__typename,
url: r.entity?.__typename === 'ExternalUrl' ? r.entity.external_url : r.entity?.url,
offset: r.offset,
length: r.length
}})) || [];
const att = node?.attachments?.[0]?.media;
return {{
postId: node.post_id,
url: node.permalink_url,
text: msg?.text || null,
textReferences: ranges,
creationTime: node?.comet_sections?.timestamp?.story?.creation_time || null,
user: {{
id: node?.actors?.[0]?.id || null,
name: node?.actors?.[0]?.name || null,
profileUrl: node?.actors?.[0]?.url || null
}},
likes: renderers?.[0]?.feedback?.reaction_count?.count ?? null,
comments: renderers?.[1]?.feedback?.comment_rendering_instance?.comments?.total_count ?? null,
shares: renderers?.[2]?.feedback?.share_count?.count ?? null,
topReactions: ufi?.top_reactions?.edges?.map(e => ({{
name: e.node?.localized_name,
count: e.reaction_count
}})) || [],
topReactionsCount: renderers?.[0]?.feedback?.reaction_count?.count ?? null,
media: att ? {{
type: att.__typename,
id: att.id || null,
viewsCount: att.video_view_count ?? null
}} : null,
feedbackId: ufi?.id || null
}};
}}
const posts = [];
// Line 0: initial edges (pinned post area)
try {{
const line0 = JSON.parse(lines[0]);
const edges = line0?.data?.node?.timeline_list_feed_units?.edges || [];
edges.forEach(e => {{
const p = extractPost(e?.node);
if (p) posts.push(p);
}});
}} catch(e) {{}}
// Lines 1 to N-1: stream posts
for (let i = 1; i < lines.length - 1; i++) {{
try {{
const j = JSON.parse(lines[i]);
const p = extractPost(j?.data?.node);
if (p) posts.push(p);
}} catch(e) {{}}
}}
// Last line: page_info (pagination)
let endCursor = null;
let hasNextPage = false;
try {{
const last = JSON.parse(lines[lines.length - 1]);
endCursor = last?.data?.page_info?.end_cursor || null;
hasNextPage = last?.data?.page_info?.has_next_page || false;
}} catch(e) {{}}
// Deduplicate by postId (edges and stream may overlap)
const seen = new Set();
const uniquePosts = posts.filter(p => {{
if (seen.has(p.postId)) return false;
seen.add(p.postId);
return true;
}});
return JSON.stringify({{
posts: uniquePosts,
pagination: {{
endCursor: endCursor,
hasNextPage: hasNextPage
}}
}});
}} catch(e) {{
return JSON.stringify({{ error: true, message: e.message }});
}}
}})()
"""
print(js)
if __name__ == '__main__':
main()
Related skills
FAQ
How does it identify the page?
It resolves the page URL to a numeric page ID with get-page-id.py, then uses that ID for all subsequent calls.
Can it filter by date?
Yes, it supports afterTime and beforeTime Unix-timestamp filters plus cursor-based pagination.