@uriva/p2b-social-media-scraper
2.0.0Description
Social media scraper using safescript. Search Facebook posts, scrape LinkedIn profiles, and fetch YouTube subtitles..
tank install @uriva/p2b-social-media-scraperSocial Media Scraper Skill
Query Facebook posts via RapidAPI and scrape LinkedIn profiles via Bright Data. All logic runs as safescript with no subprocess access.
Pass secrets via secretMapping:
{ "rapidApiKey": "RAPIDAPI_KEY", "brightDataToken": "BRIGHTDATA_TOKEN" }
Getting API Keys
RapidAPI
Used by facebookPosts and youtubeSubtitles.
- Go to rapidapi.com and create a free account.
- Subscribe (free tier) to the APIs you need:
- Facebook Scraper v3 — for Facebook posts
- YouTube Media Downloader — for YouTube subtitles
- Copy your API key from the RapidAPI dashboard.
- Add it as a bot secret (e.g. name
RAPIDAPI_KEY) with no host restrictions.
Bright Data
Used by startLinkedInProfileScrape and getLinkedInProfileSnapshot.
- Go to brightdata.com and create an account.
- Get your API token from the Bright Data dashboard.
- Add it as a bot secret (e.g. name
BRIGHTDATA_TOKEN) with hostapi.brightdata.com.
Tools
-
facebookPosts— Search or get Facebook posts. Passqueryand/orgroupId. -
startLinkedInProfileScrape— Start a LinkedIn profile scrape (max 10 URLs). Returns asnapshot_idfor polling. -
getLinkedInProfileSnapshot— Fetch status/result of a pending snapshot. -
youtubeSubtitles— Fetch SRT subtitles for a YouTube video URL.
Example usage
import { facebookPosts } from "./scripts/social-media-scraper.ss";
export const myTask = async () => {
const result = await facebookPosts(
process.env.RAPIDAPI_KEY,
"deno programming",
"",
"",
);
console.log(result);
};
The facebookPosts function accepts:
rapidApiKey— RapidAPI keyquery— Search query (empty string to omit)groupId— Facebook group ID (empty string to omit)sortingOrder— Sorting order for group posts, e.g.CHRONOLOGICAL
At least one of query or groupId must be non-empty.
Two-step flow:
- Call
startLinkedInProfileScrape(brightDataToken, urls)with up to 10 URLs. - If the response contains a
snapshot_id, callgetLinkedInProfileSnapshot(brightDataToken, snapshotId)to check progress. Repeat untilstatusis"ready"or"failed".
Valid LinkedIn URL format: https://(www.)linkedin.com/in/<username>/
YouTube
Fetch subtitles for a single YouTube video:
youtubeSubtitles(rapidApiKey, url)— Returns SRT subtitle text for a YouTube video URL. The URL must contain a video ID (e.g.https://youtube.com/watch?v=abc).