YouTube Scraper
Search results, channel videos, Shorts, live streams and playlists, with optional full video details.
Use when you need the contents of a YouTube playlist (course, series, music or channel uploads playlist): up to 100 videos in playlist order with title, channel, duration and thumbnail, plus playlist title, description and total video count.
Use when you need the contents of a YouTube playlist (course, series, music or channel uploads playlist): up to 100 videos in playlist order with title, channel, duration and thumbnail, plus playlist title, description and total video count. Accepts a playlist URL or ID (PL…, UU…, OL…). Private/missing playlists and errors are not charged.
GET https://scrapemole-api-mainnet.scrapemole.workers.dev/v1/youtube/playlist
| Name | Required | Description |
|---|---|---|
playlist | yes | Playlist URL (…?list=…) or playlist ID. |
limit | no | Max videos (1-100). Default: 50 |
lang | no | Interface language (hl), e.g. en, de. |
country | no | Country (gl), e.g. US, GB. |
// 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 or Solana. 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/playlist?playlist=PLZHQObOWTQDNU6R1_67000Dx_ZCJB-3pi'); 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.002 and the payTo address curl -i "https://scrapemole-api-mainnet.scrapemole.workers.dev/v1/youtube/playlist?playlist=PLZHQObOWTQDNU6R1_67000Dx_ZCJB-3pi" # 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.
No crypto wallet? The same data comes from our Apify Actor YouTube Scraper: batch runs, pay per result with an Apify account, export CSV/JSON, or connect n8n, Make and Zapier.
Run on Apify ↗Also available as the MCP tool youtube_playlist on https://scrapemole-api-mainnet.scrapemole.workers.dev/mcp (x402 MCP transport, same price).
A real response from this endpoint (arrays and long strings trimmed here).
{
"playlistId": "PLZHQObOWTQDNU6R1_67000Dx_ZCJB-3pi",
"playlistTitle": "Neural networks",
"playlistVideoCount": 8,
"count": 1,
"videos": [
{
"videoId": "aircAruvnKk",
"url": "https://www.youtube.com/watch?v=aircAruvnKk",
"title": "But what is a neural network? | Deep learning chapter 1",
"channelName": "3Blue1Brown",
"position": 1
}
]
}Failed calls and bad inputs are never charged. Every failure returns JSON like {"error": {"code": "NOT_FOUND", "message": "…", "charged": false}}, so an agent knows whether to fix the input or retry.
| 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. |