The job
A sponsor read is in the transcript. Check the disclosure flag, then search the timestamped text for the brand.
Endpoints
| Endpoint | Returns | Cost |
|---|---|---|
GET /v1/youtube/video/sponsors | YouTube video sponsors | 1 credit |
GET /v1/youtube/video/transcript | YouTube video transcript | 1 credit |
GET /v1/youtube/channel/videos | YouTube channel videos | 1 credit |
GET /v1/tiktok/video | TikTok video details | 1 credit |
GET /v1/instagram/profile/posts | Instagram profile posts | 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
- List a channel's videos.
- Check each for a paid-promotion disclosure.
- Find the brand's name in the transcript.
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"]
# YouTube channel videos
videos = get("/v1/youtube/channel/videos", handle="mkbhd", sort="latest")
# YouTube video sponsors
sponsors = get("/v1/youtube/video/sponsors", url=videos["items"][0]["url"])
# YouTube video transcript
transcript = get("/v1/youtube/video/transcript", url=videos["items"][0]["url"])
brand = "squarespace"
hits = [s for s in transcript["segments"] if brand in s["text"].lower()]
print(sponsors["extra"], len(hits))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;
}
// YouTube channel videos
const videos = await get("/v1/youtube/channel/videos", { handle: "mkbhd", sort: "latest" });
// YouTube video sponsors
const sponsors = await get("/v1/youtube/video/sponsors", { url: videos.items[0].url });
// YouTube video transcript
const transcript = await get("/v1/youtube/video/transcript", { url: videos.items[0].url });
const brand = "squarespace";
const hits = transcript.segments.filter((s: any) => s.text.toLowerCase().includes(brand));
console.log(sponsors.extra, hits.length);Good to know
Sponsor inference is experimental and returns a confidence. Treat it as a lead to check, not a verdict.