YouTube search with metrics

Search one page of videos, then add view counts and durations with one batch lookup. The optional workflow keeps the original search records, their precise publish dates and their continuation cursor.

Preview, then run

Download the Node.js workflow. With Node.js 22 or newer, set MONOCRAWL_API_KEY and run a free estimate:

node youtube-search-metrics.mjs '{"query":"space exploration","maxResults":25,"maxVideos":25,"maxCredits":3,"estimateOnly":true}'

Remove estimateOnly to execute. The workflow uses the public GET endpoints with your key. It checks both prices before spending, checks again before each request, and sends a per-call X-Max-Credits ceiling. Choose maxCredits using the current estimate.

maxResults accepts 1–50 and defaults to 25. maxVideos accepts 0–50 and defaults to 50; zero runs search only. One run reads one search page and at most one batch of distinct video IDs. It never fans out into one lookup per video.

Read the enriched results

Each search row retains its existing fields and gains metrics: views, likes, comments and duration_seconds. A measured zero stays zero; unavailable values stay null. metrics_status explains whether the lookup succeeded, was unrequested, unavailable or failed.

The join uses the exact video ID and never overwrites published_at. Rows retain their order even if the batch answers in a different order, omits a private video or fails. The returned cursor and has_more still describe the search page; pass the cursor back with the same query and key for another explicitly priced run.

Ordinary youtube/search requests keep their existing response and cost. This downloadable helper adds the batch only when you run it.

Costs and partial results

ComponentCurrent base price
youtube/search1 credits
youtube/videos2 credits

The maximum is one search price plus one GET video-batch price. Empty searches skip the batch, and cache hits can lower the charge. The helper reports its ledger and confirmed credits. maxDurationSeconds defaults to 90 and accepts 1–180.

A missing paid response stops the workflow without automatic retries, retains that request’s maximum charge under credits_reserved_unknown, and reports a partial result. Check account usage before retrying. A successful search remains charged if a later enrichment fails.

First call in under a minute

150 free credits and a ready-made key the moment you sign up. No card.