TikTok search with music IDs
Search a page, then look up a bounded number of posts whose exact music IDs are missing. The optional workflow preserves search order, dates and continuation.
Preview, then run
Download the Node.js workflow. With Node.js 22 or newer, set MONOCRAWL_API_KEY and preview the maximum price:
node tiktok-search-music.mjs '{"query":"space exploration","maxPosts":5,"maxCredits":6,"estimateOnly":true}'Remove estimateOnly to run. maxPosts defaults to five and accepts 0–10. Zero runs search only. Each selected distinct post adds one normally priced lookup; duplicated posts share one lookup. Posts that already have an exact music ID need no lookup.
Pass cursor, region, publish_time and sort_by when needed. Continue using the same key and search inputs. A run acquires only one search page. maxDurationSeconds defaults to 180 and accepts 1–300.
Exact IDs and partial results
Search sources can omit an ID or send an integer that was already rounded upstream. Those values remain null. A matching post lookup can supply the exact string ID for the music. The workflow checks the returned post identity before filling music.id, and preserves the other search fields.
music_lookup_status distinguishes a successful lookup, an existing ID, an unrequested lookup and an unavailable or failed result. Search rows, timestamps and cursors survive enrichment failures. Availability varies by post; this workflow does not guarantee an ID for every sound.
Ordinary top search keeps its existing price and pagination. Extra requests happen only when this workflow is run.
Bound total spending
| Component | Current base price |
|---|---|
tiktok/search-top | 1 credits |
tiktok/post | 1 credits |
The initial estimate covers one search plus maxPosts lookups. An insufficient maxCredits budget spends nothing. Every paid request gets a fresh price preview and an X-Max-Credits ceiling. Missing rows, existing music IDs and cache hits can reduce the final charge.
The ledger reports confirmed credits and credits_reserved_unknown. A lost paid response stops further spending without an automatic retry; check account usage before rerunning. Search remains charged when a later lookup fails.