Scrape a YouTube channel's about page, stats and recent videos to JSON in one call. Built on the Scrapier API: one HTTPS request, no headless browser to run, no parser to maintain.
Quickstart · Fields · CLI · FAQ
-
Get an API key from the Scrapier dashboard. No credit card needed to start.
-
Install:
pip install git+https://github.com/get-scrapier/YouTube-Channel-Scraper
-
Run:
from scrapier_youtube_channel_info import YoutubeChannelInfo
client = YoutubeChannelInfo(api_key="sk_live_...") # or set SCRAPIER_API_KEY
channel = client.channel_info("MrBeast")[0]
print(channel["stats"]) # subscribers live in here
print(channel["about"]) # description and links
print(len(channel["videos"]), "recent videos")The same code is in examples/quickstart.py.
- Creator discovery
- Sponsorship evaluation
- Competitor tracking
- Lead research
Reads a channel's whole public surface in one request: the about page, the subscriber and view statistics, and the recent items from its videos, shorts, live and community tabs.
One call instead of five. For a deep walk of any single tab, use the dedicated endpoint -- this returns the recent slice of each.
Wraps the Scrapier youtube-channel-info endpoint.
rows = client.channel_info(channel) # a list
page = client.channel_info_page(channel)
page.items # the same rows
page.data # the whole envelopeOne request. This endpoint does not paginate, so there is no cursor and
no iter_ method.
Observed on live responses, not copied from a schema.
| Field | Notes |
|---|---|
about |
the description, links, location and join date |
stats |
subscribers, total views and video count |
videos |
the recent videos tab |
shorts |
the recent shorts tab |
live |
the recent live tab |
posts |
the recent community posts |
channelUrl, input |
identity, and what you asked for |
scrapedAt |
when |
Everything is nested, and nothing is flat. There is no
subscribers or title at the top level -- they are inside
stats and about respectively. The row is six blocks and three
scalars, which is what makes it one call rather than five.
It does not paginate. Measured live: next_cursor comes back
None and one row arrives per channel, so there is no iter_
method here. The tabs carry a recent slice, not the whole history.
For a full tab, use the dedicated endpoint.
scrapier-youtube-channel-video-scraper walks every video,
scrapier-youtube-channel-live every stream, and
scrapier-youtube-community-posts every post. This endpoint's tabs
are a preview.
Field names are camelCase here (channelUrl, scrapedAt) while
most other YouTube endpoints in this family are snake_case.
AsyncYoutubeChannelInfo exposes every method YoutubeChannelInfo
does, with identical arguments.
import asyncio
from scrapier_youtube_channel_info import AsyncYoutubeChannelInfo
async def main():
async with AsyncYoutubeChannelInfo() as client:
rows = await client.channel_info(channel)
asyncio.run(main())For hundreds of inputs, submit one background job instead of paging:
job = client.bulk([...], max_items=1000) # up to 10,000 per input
print(job.job_id, job.status)
rows = job.wait(timeout=1800, poll_interval=5)Reattach from another process with client.job(job_id), then read
job.data.
Submits are deduplicated server-side on the request parameters, so an identical submit returns the job the first one created — including when that job failed. Vary a parameter to force a fresh attempt.
Everything derives from ScrapierError, so one except can catch the
lot while you still get to be specific when it matters.
from scrapier_youtube_channel_info import InsufficientCreditsError, RateLimitError, ScrapierError
try:
rows = client.channel_info(channel)
except InsufficientCreditsError as exc:
print(f"out of credits: {exc.balance} left, {exc.required} needed")
except RateLimitError as exc:
print(f"slow down for {exc.retry_after}s")
except ScrapierError as exc:
print(f"something else: {exc}")| Exception | When |
|---|---|
ConfigurationError |
no API key, or a reserved parameter was passed |
TransportError |
the request never got a response |
BadRequestError |
400 — bad input |
AuthenticationError |
401 — bad or missing key |
InsufficientCreditsError |
402 with a balance — carries .balance and .required |
NotFoundError |
404 |
RateLimitError |
429 — carries .retry_after |
ScrapeTimeoutError |
504 — the scrape itself ran out of time |
ServiceUnavailableError |
503 |
ServerError |
5xx |
JobFailedError |
a bulk job finished in failed — carries .errors |
APIError |
the base for anything with a status code |
429, 503, 5xx and transport failures are retried automatically with
jittered backoff that honours Retry-After. 400, 401, 404 and a 402
about your balance are not — retrying those only wastes time.
export SCRAPIER_API_KEY=sk_live_...
scrapier-youtube-channel-info <channel>JSON on stdout and nothing else, so it pipes. Global flags (--api-key,
--base-url, --timeout, --jsonl, --indent) work anywhere on the
line. Exit codes: 0 success, 2 usage or configuration, 3 API
error.
YoutubeChannelInfo(
api_key=None, # falls back to $SCRAPIER_API_KEY
base_url=None, # falls back to $SCRAPIER_BASE_URL, then the default
timeout=120.0,
max_retries=3, # for 429/503/5xx and transport failures
http_client=None, # bring your own httpx.Client
)The key is sent in the X-API-Key header only — never in a URL or a
request body, so it will not end up in a proxy log.
Every call also accepts method="GET" if you would rather the
parameters went in the query string, use_proxy=True to route the
scrape through Scrapier's proxy pool, and raw_data=True to get the
upstream payloads instead of parsed rows.
Python 3.9+. The only dependency is httpx. Ships py.typed.
The client code is MIT-licensed. It needs a Scrapier API key, and requests are billed in credits; failed requests are not billed. See pricing. You can start without a credit card.
No. The scrape runs on Scrapier's servers and returns JSON.
Use bulk jobs: submit many inputs as one background job, then job.wait().
Yes. See AGENTS.md, or connect the
Scrapier MCP server.
180+ endpoints across 35+ platforms: browse them all.
Open an issue or read the docs.
MIT. See LICENSE.