- Use cases
- Music and sound tracking
Music and sound tracking
See which videos use a sound and read the track behind it.
The job
A track takes off when many videos use it. List the videos on a sound, then read the track and artist from a streaming catalogue.
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 song details | 1 credit | |
| TikTok videos using a song | 1 credit | |
| Spotify search | 1 credit | |
| Spotify track | 1 credit | |
| Spotify artist | 1 credit |
Recipe
- Open the sound on TikTok.
- List the videos that use it.
- Search the same title on Spotify.
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# Spotify search14found = get("/v1/spotify/search", query="Espresso", type="track")15# Spotify track16track = get("/v1/spotify/track", url=found["items"][0]["url"])1718print(track)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// Spotify search12const found = await get("/v1/spotify/search", { query: "Espresso", type: "track" });13// Spotify track14const track = await get("/v1/spotify/track", { url: found.items[0].url });1516console.log(track);Calls use api.socialscrape.dev and return the shapes in the reference.
Good to know
Replace the example title with your own. Counts on a TikTok sound are what the platform shows at the time.