Sand AISand AI MAGI-2MAGI-2 现已上线 SandBase:支持原生音频的 1080p 视频立即试用

YouTube Video Streams (V2)

API 文档
https://api.sandbase.ai/v1/api/youtube/web-v2/video-streams-v2

Retrieves stream information and playback details for a YouTube video. Queries data using either a video ID or a full video URL.

价格
$0.004美元 / 次调用
方法
POST
响应
JSON
参数
0 个必填 · 2 个可选

Playground

输入
Video ID (recommended)
Full video URL (optional, ignored if video_id is provided)
输出就绪

您的输出将显示在这里

完成输入,然后点击运行。

API README

YouTube Video Streams (V2) API

Returns stream details for one YouTube video: title, author, length, view count, and lists of downloadable video and audio formats with their URLs. It needs a video_id or a full video_url.

Use cases

  • List the audio-only formats of a video to build a podcast-style player.
  • Pick a progressive MP4 format by quality_label and height for in-app playback.
  • Check is_live and length_seconds before queuing a video for processing.
  • Compare content_length across formats to estimate download sizes.

Request

curl -X POST "https://api.sandbase.ai/v1/api/youtube/web-v2/video-streams-v2" \
  -H "Authorization: Bearer $SANDBASE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"video_id": "dQw4w9WgXcQ", "video_url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"}'

The result is returned in outputs[0].data.

Parameters

NameTypeRequiredDescription
video_idstringNoVideo ID (recommended)
video_urlstringNoFull video URL (optional, ignored if video_id is provided)

Example response

Real response for the request above, trimmed: lists keep their first item and long strings are cut.

{
  "adaptive_formats": [
    {
      "audio_quality": 30.813,
      "audio_sample_rate": 22050,
      "bitrate": 30.813,
      "content_length": 821022,
      "fps": null,
      "has_signature": false,
      "height": null,
      "itag": 599,
      "mime_type": "audio/mp4",
      "quality": "ultralow",
      "quality_label": "audio only",
      "type": "audio"
    }
  ],
  "author": "Rick Astley",
  "available_qualities": [
    "audio only"
  ],
  "expires_in_seconds": 21600,
  "formats": [
    {
      "audio_quality": null,
      "audio_sample_rate": 44100,
      "bitrate": 444.226,
      "content_length": 11832459,
      "fps": 25,
      "has_signature": false,
      "height": 360,
      "itag": 18,
      "mime_type": "video/mp4",
      "quality": "360p",
      "quality_label": "640x360",
      "type": "video"
    }
  ],
  "is_live": false,
  "length_seconds": 213,
  "short_description": "The official video for “Never Gonna Give You Up” by Rick Astley. \n\nNever: The Au…",
  "strategy": "account_mweb",
  "thumbnail": [
    {
      "url": "https://i.ytimg.com/vi_webp/dQw4w9WgXcQ/maxresdefault.webp"
    }
  ],
  "title": "Rick Astley - Never Gonna Give You Up (Official Video) (4K Remaster)",
  "video_id": "dQw4w9WgXcQ"
}

Response fields

FieldMeaning
title / author / video_idVideo title, channel name, and the 11-character video ID.
length_seconds / view_countVideo length in seconds and the view count.
is_livetrue if the video is a live stream, false otherwise.
short_descriptionStart of the video description text. Long descriptions are cut.
thumbnail[].urlLink to a thumbnail image for the video.
formats[]Formats that carry video in a single file. Each row has itag, mime_type, quality, quality_label, width, height and fps.
adaptive_formats[]Separate audio-only or video-only formats. Check type to tell them apart, and audio_sample_rate for audio rows.
formats[].url / adaptive_formats[].urlDirect stream URL for that format. It stops working after the time set in expires_in_seconds.
bitrate / content_lengthBitrate value and file size of the format. content_length is the size of the stream data.
available_qualities / expires_in_secondsQuality labels found in the response, and the number of seconds the stream URLs stay valid.

Notes

  • Send video_id when you can. The API ignores video_url if video_id is set.
  • The video_id is the value after v= in a watch URL, such as dQw4w9WgXcQ.
  • Stream URLs are time-limited. Use them within expires_in_seconds of the call.
  • For title, description and stats without stream links, see YouTube Video Information (V2). For captions, see YouTube Video Captions.

Pricing

$0.004 per successful call. Failed calls are not charged. It is included in the daily free quota of each organization.

探索更多

相关 APIs

全部 APIs
API价格响应
YouTube$0.004 每次调用JSON
YouTube$0.001 每次调用JSON
YouTube$0.001 每次调用JSON
YouTube$0.001 每次调用JSON
YouTube$0.001 每次调用JSON
YouTube$0.001 每次调用JSON

指南:Best YouTube API in 2026: Pricing Compared

问题

常见问题

如何使用 YouTube Video Streams (V2) API?

向 https://api.sandbase.ai/v1/api/youtube/web-v2/video-streams-v2 发送 POST 请求,在 Authorization 请求头中使用您的 SandBase API key(Bearer),并将参数作为 JSON 请求体传入。您也可以直接在本页的 Playground 中试用,无需编写代码。

YouTube Video Streams (V2) API 的价格是多少?

每次调用 $0.004,从您的 SandBase 余额中扣费。您只需为实际调用付费;无需订阅。

YouTube Video Streams (V2) API 接受哪些参数?

无需参数。 可选:video_id (string) 和 video_url (string)。 Parameters 表和本页的 Playground 列出了每个字段。

YouTube Video Streams (V2) API 返回什么?

在同一个 HTTP 请求中返回的 JSON 响应(同步)。 本页的 README 包含一个示例响应。

我需要 YouTube 开发者账户或 API key 吗?

不需要。YouTube Video Streams (V2) 通过 SandBase 运行,因此一个 SandBase API key 即可覆盖此端点以及目录中的其他所有 API 和模型。您无需单独申请 YouTube API 访问权限。