The job
Listening starts with one question: who mentioned us today? Search each platform for your terms, store the rows, and run the same query on a schedule.
Endpoints
| Endpoint | Returns | Cost |
|---|---|---|
GET /v1/tiktok/search/keyword | TikTok video search | 1 credit |
GET /v1/youtube/search | YouTube search | 1 credit |
GET /v1/instagram/search/reels | Instagram reel search | 1 credit |
GET /v1/threads/search | Threads post search | 1 credit |
GET /v1/twitter/search/posts | X post search | 1 credit |
POST /v1/monitors | Create a monitor | Free |
Failed requests and cached repeats cost 0 credits. Send max_age_days to accept a recent cached copy. See credits and caching.
Recipe
- Search each platform for the same term.
- Keep the ids, so a repeat run only adds what is new.
- Watch a search with a monitor instead of polling it.
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"]
# TikTok video search
tiktok = get("/v1/tiktok/search/keyword", query="standing desk", sort="latest", date_posted="week")
# YouTube search
youtube = get("/v1/youtube/search", query="standing desk", type="video", upload_date="week")
for post in tiktok["items"] + youtube["items"]:
print(post["platform"], post["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;
}
// TikTok video search
const tiktok = await get("/v1/tiktok/search/keyword", { query: "standing desk", sort: "latest", date_posted: "week" });
// YouTube search
const youtube = await get("/v1/youtube/search", { query: "standing desk", type: "video", upload_date: "week" });
for (const post of [...tiktok.items, ...youtube.items]) console.log(post.platform, post.url);Good to know
Each platform ranks its own search, so the same term gives different lists. Twitter/X search goes through a web search engine, so it is a sample of public posts, not the full firehose.