- Use cases
- Brand monitoring API
Brand monitoring API
Find videos that mention your brand and read what people say under them.
The job
Search your brand name and campaign hashtag, then open the comments on the videos that matter. Keep the ids to avoid reading the same video twice.
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 |
|---|---|---|
| TikTok videos by hashtag | 1 credit | |
| TikTok video search | 1 credit | |
| YouTube search | 1 credit | |
| TikTok video comments | 1 credit | |
| YouTube video comments | 1 credit |
Recipe
- Search the brand and the hashtag.
- Open comments on the top videos.
- Store what you have seen by id.
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# TikTok videos by hashtag14tagged = get("/v1/tiktok/search/hashtag", hashtag="standingdesk")15# TikTok video comments16comments = get("/v1/tiktok/video/comments", url=tagged["items"][0]["url"])1718for c in comments["items"]:19 print(c["stats"]["likes"], c["text"])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// TikTok videos by hashtag12const tagged = await get("/v1/tiktok/search/hashtag", { hashtag: "standingdesk" });13// TikTok video comments14const comments = await get("/v1/tiktok/video/comments", { url: tagged.items[0].url });1516for (const c of comments.items) console.log(c.stats.likes, c.text);Calls use api.socialscrape.dev and return the shapes in the reference.
Good to know
TikTok hashtag search can return duplicates, so de-duplicate by id.