The job
Product research is search, then depth. Find what sells under a keyword, open the product, and read the reviews for what buyers complain about.
Endpoints
| Endpoint | Returns | Cost |
|---|---|---|
GET /v1/tiktok/shop/search | TikTok Shop product search | 1 credit |
GET /v1/tiktok/shop/product | TikTok Shop product details | 1 credit |
GET /v1/tiktok/shop/product/reviews | TikTok Shop product reviews | 1 credit |
GET /v1/tiktok/shop/products | TikTok Shop products of a shop | 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
- Search a keyword.
- Open the products with the highest sold count.
- Read their reviews.
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 Shop product search
found = get("/v1/tiktok/shop/search", query="water bottle")
# TikTok Shop product details
product = get("/v1/tiktok/shop/product", url=found["items"][0]["url"])
# TikTok Shop product reviews
reviews = get("/v1/tiktok/shop/product/reviews", url=found["items"][0]["url"])
for r in reviews["items"]:
print(r["text"])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 Shop product search
const found = await get("/v1/tiktok/shop/search", { query: "water bottle" });
// TikTok Shop product details
const product = await get("/v1/tiktok/shop/product", { url: found.items[0].url });
// TikTok Shop product reviews
const reviews = await get("/v1/tiktok/shop/product/reviews", { url: found.items[0].url });
for (const r of reviews.items) console.log(r.text);Good to know
TikTok decides how deep a search goes, and reviews come 5 a page.