The job
Ad libraries are public, and each has its own search. Find the advertiser, list its ads, and transcribe the video ones to read the script.
Endpoints
| Endpoint | Returns | Cost |
|---|---|---|
GET /v1/facebook/ad-library/search/companies | Facebook Ad Library advertiser search | 1 credit |
GET /v1/facebook/ad-library/company/ads | Facebook Ad Library ads by page | 1 credit |
GET /v1/facebook/ad-library/ad/transcript | Facebook Ad Library ad transcript | 1 credit |
GET /v1/google/ad-library/company/ads | Google Ads Transparency ads by advertiser | 1 credit |
GET /v1/linkedin/ad-library/search | LinkedIn Ad Library search | 1 credit |
GET /v1/tiktok/ad-library/search | TikTok Ad Library search | 1 credit |
Failed requests and cached repeats cost 0 credits. Send max_age_days to accept a recent cached copy. See credits and caching.
Recipe
- Find the advertiser by name.
- List its ads, newest first.
- Transcribe the video ads.
Preview
The API is in early access. Calls use
api.socialscrape.io and return the shapes in the reference.Python
import os
import requests
API = "https://api.socialscrape.io"
HEADERS = {"x-api-key": os.environ["SOCIALSCRAPE_API_KEY"]}
def get(path, **params):
res = requests.get(API + path, headers=HEADERS, params=params, timeout=60)
res.raise_for_status()
return res.json()["data"]
# Facebook Ad Library advertiser search
found = get("/v1/facebook/ad-library/search/companies", query="Notion")
# Facebook Ad Library ads by page
ads = get("/v1/facebook/ad-library/company/ads", company_name="Notion", status="active", sort="newest")
for ad in ads["items"][:10]:
print(ad["url"])TypeScript
const API = "https://api.socialscrape.io";
const headers = { "x-api-key": process.env.SOCIALSCRAPE_API_KEY! };
async function get(path: string, params: Record<string, string | number | boolean>) {
const query = new URLSearchParams(Object.entries(params).map(([k, v]) => [k, String(v)]));
const res = await fetch(`${API}${path}?${query}`, { headers });
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`);
return (await res.json()).data;
}
// Facebook Ad Library advertiser search
const found = await get("/v1/facebook/ad-library/search/companies", { query: "Notion" });
// Facebook Ad Library ads by page
const ads = await get("/v1/facebook/ad-library/company/ads", { company_name: "Notion", status: "active", sort: "newest" });
for (const ad of ads.items.slice(0, 10)) console.log(ad.url);Good to know
Libraries show what each platform chooses to publish. Meta and Google differ in what they disclose, so fields vary between libraries.