Skip to content

About

YouTube scraper API: YouTube Channel Details, YouTube Video Comments, YouTube Video Details as clean JSON. Python examples with requests, Scrapy, asyncio and the DataGuru SDK.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

YouTube Scraper API

Scrape YouTube with a JSON API. This repo has working Python examples for DataGuru's YouTube scraper APIs: YouTube Channel Details, YouTube Video Comments and YouTube Video Details.

DataGuru runs the scraping, proxies, retries and parsing, and returns clean JSON. You pay only for successful requests, from $0.0012 per request, out of a prepaid balance: no subscription. New accounts get $1.00 of free credit.

YouTube APIs

API What it returns Price Page
YouTube Channel Details Scrape YouTube channel metadata, subscriber count, total video count, description, and links. $0.0022 https://dataguru.cc/apis/youtube-channel/
YouTube Video Comments Extract top comments, author usernames, upvote counts, and replies from a YouTube video. $0.0012 https://dataguru.cc/apis/youtube-comments/
YouTube Video Details Extract YouTube video details, views, likes, publication date, description, and tags. $0.0022 https://dataguru.cc/apis/youtube-video/

Quick start

  1. Create a free account and an API key at dashboard.dataguru.cc.
  2. Install and run:
git clone https://github.com/dataguru-cc/youtube-scraper-api.git
cd youtube-scraper-api
pip install -r requirements.txt
export DATAGURU_API_KEY="your key"
python examples/sdk_example.py youtube-channel

Examples

Every example covers all 3 YouTube APIs. Pass an API name to run just one; with no name each script runs them all, and each call is billed at the price above.

File Style Run
examples/sdk_example.py DataGuru Python SDK (pip install dataguru-sdk), one function per API, saves JSON to output/ python examples/sdk_example.py
examples/requests_example.py Plain requests, synchronous python examples/requests_example.py
examples/async_example.py asyncio + httpx, concurrent with a limit python examples/async_example.py
examples/scrapy_spider.py Scrapy spider, items to JSON/CSV scrapy runspider examples/scrapy_spider.py -O youtube.json

All requests use the header Authorization: Api-Key YOUR_API_KEY. Errors return {"success": false, "error": {"code", "message", "request_id"}}, with HTTP 402 when the balance runs out and 429 (with Retry-After) when rate limited. Failed requests are not charged.

API reference

YouTube Channel Details

Scrape YouTube channel metadata, subscriber count, total video count, description, and links.

Parameter Type Required Description
target string yes YouTube channel URL or @handle

Response fields: about, channel, highlighted_video, videos_sections, shorts_sections, plus _metadata

curl -X POST "https://api.dataguru.cc/api/v1/youtube/channel" \
  -H "Authorization: Api-Key $DATAGURU_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"target": "@MrBeast"}'
Response schema

Values are type placeholders from the API's published schema, not real data.

{
  "about": {
    "description": "string",
    "subscribers": "string",
    "subscribers_extracted": 0,
    "videos": "string",
    "views": "string",
    "joined_date_text": "string",
    "joined_date": "2026-01-01T12:00:00Z",
    "links": [
      "string"
    ]
  },
  "channel": {
    "handle": "string",
    "id": "1234567890",
    "title": "string",
    "subscribers": "string",
    "videos": "string",
    "description": "string",
    "keywords": "string",
    "available_countries": [
      "string"
    ],
    "tags": [
      "string"
    ],
    "facebook_profile_id": "1234567890",
    "first_link": "https://example.com/...",
    "is_family_safe": false,
    "avatar": "string",
    "banner": "string"
  },
  "highlighted_video": {
    "id": "1234567890",
    "title": "string",
    "link": "https://example.com/...",
    "description": "string",
    "external_links": [
      "string"
    ],
    "views": "string",
    "published_time": "string"
  },
  "videos_sections": [
    {
      "section_title": "string",
      "videos": [
        "string"
      ]
    }
  ],
  "shorts_sections": [
    {
      "section_title": "string",
      "videos": [
        "string"
      ]
    }
  ],
  "_metadata": {
    "request_id": "3f6c1a2e-8b4d-4c1e-9a7f-2d5e6b7c8d9e",
    "execution_time_ms": 842,
    "endpoint": "YouTube Channel Details",
    "mode": "live",
    "format": "json",
    "timestamp": "2026-01-01T12:00:00+00:00"
  }
}

YouTube Video Comments

Extract top comments, author usernames, upvote counts, and replies from a YouTube video.

Parameter Type Required Description
limit integer no Number of comments to return Default: 20.
video_url string yes YouTube video URL

Response fields: comment_id, link, channel, published_date, text, likes, replies, replies_next_page_token, plus _metadata

curl -X POST "https://api.dataguru.cc/api/v1/youtube/comments" \
  -H "Authorization: Api-Key $DATAGURU_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"video_url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ", "limit": 10}'
Response schema

Values are type placeholders from the API's published schema, not real data.

{
  "comments": [
    {
      "comment_id": "1234567890",
      "link": "https://example.com/...",
      "channel": {
        "id": "1234567890",
        "handle": "string",
        "link": "https://example.com/...",
        "thumbnail": "string"
      },
      "published_date": "2026-01-01T12:00:00Z",
      "text": "string",
      "likes": "string",
      "replies": "string",
      "replies_next_page_token": "string"
    }
  ],
  "_metadata": {
    "request_id": "3f6c1a2e-8b4d-4c1e-9a7f-2d5e6b7c8d9e",
    "execution_time_ms": 842,
    "endpoint": "YouTube Video Comments",
    "mode": "live",
    "format": "json",
    "timestamp": "2026-01-01T12:00:00+00:00"
  }
}

YouTube Video Details

Extract YouTube video details, views, likes, publication date, description, and tags.

Parameter Type Required Description
target string yes YouTube video URL or video ID

Response fields: video_id, title, description, channel_id, channel_title, publish_date, category, duration_seconds, high_res_thumbnail_urls, tags_keywords, view_count, like_count, comment_count, plus _metadata

curl -X POST "https://api.dataguru.cc/api/v1/youtube/video" \
  -H "Authorization: Api-Key $DATAGURU_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"target": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"}'
Response schema

Values are type placeholders from the API's published schema, not real data.

{
  "video_metadata": {
    "video_id": "1234567890",
    "title": "string",
    "description": "string",
    "channel_id": "1234567890",
    "channel_title": "string",
    "publish_date": "2026-01-01T12:00:00Z",
    "category": "string",
    "duration_seconds": 0,
    "high_res_thumbnail_urls": [
      "https://example.com/..."
    ],
    "tags_keywords": [
      "string"
    ],
    "view_count": 0,
    "like_count": 0,
    "comment_count": 0
  },
  "_metadata": {
    "request_id": "3f6c1a2e-8b4d-4c1e-9a7f-2d5e6b7c8d9e",
    "execution_time_ms": 842,
    "endpoint": "YouTube Video Details",
    "mode": "live",
    "format": "json",
    "timestamp": "2026-01-01T12:00:00+00:00"
  }
}

More

License

The example code is MIT licensed. Use of the DataGuru API is subject to the terms of service.

About

YouTube scraper API: YouTube Channel Details, YouTube Video Comments, YouTube Video Details as clean JSON. Python examples with requests, Scrapy, asyncio and the DataGuru SDK.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors