- Use cases
- Ad research from ad libraries
Ad research from ad libraries
Find a company's running ads across ad libraries.
The job
Each ad library has its own search. Find the advertiser, list its ads, and transcribe the video ones to read the script.
Endpoints
Failed requests and cached repeats cost 0 credits. Send max_age_days to accept a recent cached copy. See credits and caching.
| Endpoint | Returns | Cost |
|---|---|---|
| Facebook Ad Library advertiser search | 1 credit | |
| Facebook Ad Library ads by page | 1 credit | |
| Facebook Ad Library ad transcript | 1 credit | |
| Google Ads Transparency ads by advertiser | 1 credit | |
| LinkedIn Ad Library search | 1 credit | |
| TikTok Ad Library search | 1 credit |
Recipe
- Find the advertiser by name.
- List its ads, newest first.
- Transcribe the video ads.
1import os2import requests34API = "https://api.socialscrape.dev"5HEADERS = {"x-api-key": os.environ["SOCIALSCRAPE_API_KEY"]}678def get(path, **params):9 res = requests.get(API + path, headers=HEADERS, params=params, timeout=60)10 res.raise_for_status()11 return res.json()["data"]1213# Facebook Ad Library advertiser search14found = get("/v1/facebook/ad-library/search/companies", query="Notion")15# Facebook Ad Library ads by page16ads = get("/v1/facebook/ad-library/company/ads", company_name="Notion", status="active", sort="newest")1718for ad in ads["items"][:10]:19 print(ad["url"])1const API = "https://api.socialscrape.dev";2const headers = { "x-api-key": process.env.SOCIALSCRAPE_API_KEY! };34async function get(path: string, params: Record<string, string | number | boolean>) {5 const query = new URLSearchParams(Object.entries(params).map(([k, v]) => [k, String(v)]));6 const res = await fetch(`${API}${path}?${query}`, { headers });7 if (!res.ok) throw new Error(`${res.status} ${await res.text()}`);8 return (await res.json()).data;9}1011// Facebook Ad Library advertiser search12const found = await get("/v1/facebook/ad-library/search/companies", { query: "Notion" });13// Facebook Ad Library ads by page14const ads = await get("/v1/facebook/ad-library/company/ads", { company_name: "Notion", status: "active", sort: "newest" });1516for (const ad of ads.items.slice(0, 10)) console.log(ad.url);Calls use api.socialscrape.dev and return the shapes in the reference.
Good to know
Libraries show what each platform chooses to publish. Meta and Google differ in what they disclose, so fields vary between libraries.