YouTube video details API
Use when you need the details of one YouTube video: exact view count, like count, comment count, duration, publish/upload date, category, full description, keywords/tags, live status and thumbnail. Accepts a video URL, Shorts URL or 11-character ID. $0.003 per successful call; unavailable/private videos and errors are not charged.
Parameters
GET https://scrapemole-api-mainnet.scrapemole.workers.dev/v1/youtube/video
| Name | Required | Description |
|---|---|---|
video | yes | YouTube video URL or 11-character video ID. |
lang | no | Interface language (hl), e.g. en, de. |
country | no | Country (gl), e.g. US, GB. |
Call it
// npm i @x402/fetch @x402/evm viem import { wrapFetchWithPaymentFromConfig, decodePaymentResponseHeader } from '@x402/fetch'; import { ExactEvmScheme } from '@x402/evm'; import { privateKeyToAccount } from 'viem/accounts'; // Your agent's own wallet, holding a little USDC on Base. No ScrapeMole account or API key. const account = privateKeyToAccount(process.env.AGENT_PRIVATE_KEY); const pay = wrapFetchWithPaymentFromConfig(fetch, { schemes: [{ network: 'eip155:8453', client: new ExactEvmScheme(account) }], }); // On 402 the wrapper signs the USDC authorization and retries once. const res = await pay('https://scrapemole-api-mainnet.scrapemole.workers.dev/v1/youtube/video?video=aircAruvnKk'); console.log(res.status, await res.json()); // Settled only on 200; the receipt (tx hash) is in the PAYMENT-RESPONSE header. if (res.ok) console.log(decodePaymentResponseHeader(res.headers.get('payment-response')));
# 1. Unpaid: returns 402 with price $0.003 and the payTo address curl -i "https://scrapemole-api-mainnet.scrapemole.workers.dev/v1/youtube/video?video=aircAruvnKk" # 2. Paid: repeat the request with a PAYMENT-SIGNATURE header (a signed USDC # authorization for the quoted amount). An x402 client does this for you: # see the JavaScript tab.
Also available as the MCP tool youtube_video on https://scrapemole-api-mainnet.scrapemole.workers.dev/mcp (x402 MCP transport, same price).
Example response
A real response from this endpoint (arrays and long strings trimmed here).
{
"videoId": "aircAruvnKk",
"title": "But what is a neural network? | Deep learning chapter 1",
"channelName": "3Blue1Brown",
"channelId": "UCYO_jab_esuFRV4b17AJtAw",
"channelHandle": "@3blue1brown",
"viewCount": 21000000,
"likeCount": 400000,
"commentCount": 9000,
"durationSeconds": 1118,
"publishDate": "2017-10-05",
"category": "Education",
"keywords": [
"neural networks",
"deep learning"
],
"isLive": false,
"url": "https://www.youtube.com/watch?v=aircAruvnKk"
}Live test results
1/1Paid calls through the deployed Worker, 12 Oct 2026 08:12 UTC
Paid end-to-end checks (Base Sepolia testnet, 12 Oct 2026 08:12 UTC)
| Call | Status | Charged | Pass |
|---|---|---|---|
unpaid /v1/youtube/video | 402 | price quoted | ✓ |
paid /v1/youtube/video?video=aircAruvnKk | 200 | $0.003 | ✓ |
paid /v1/youtube/video?video=xxxxxxxxxxx (unknown video) | 404 | $0 | ✓ |
Errors
Failures return JSON like {"error": {"code": "NOT_FOUND", "message": "…", "charged": false}}. None of them are charged.
| Status / errorCode | Meaning |
|---|---|
400 INVALID_INPUT | Missing or malformed parameter. Fix the input. |
404 NOT_FOUND | The video, channel, product or term doesn't exist or isn't public. |
404 NO_DATA | It exists, but has nothing to return (for example no captions). |
503 BLOCKED | The source rate-limited us even after retries. Try again later. |
502 / 504 | Upstream error or timeout. Try again. |
402 | No or invalid payment. Pay the quoted amount and retry. |