Sand AISand AI MAGI-2MAGI-2 現已登上 SandBase:支援原生音訊的 1080p 影片立即試用

YouTube General Search (Web V2, V2)

API 文件
https://api.sandbase.ai/v1/api/youtube/web-v2/general-search-v2

Returns YouTube search results matching a query keyword. Supports filtering by content type, upload date, duration, features, and sorting options, with pagination via tokens.

價格
$0.002美元/次呼叫
方法
POST
回應
JSON
參數
0 個必填 · 7 個選填

Playground

輸入
Pagination token (pass from previous response for next page)
Video duration filter - short(<4min)/medium(4-20min)/long(>20min)
Feature filter (comma separated) - live/4k/hd/subtitles/creative_commons/360/vr180/3d/hdr
Search keyword (required for first request)
Sort by - relevance/upload_date/view_count/rating
Result type filter - video/channel/playlist/movie
Upload date filter - last_hour/today/this_week/this_month/this_year
輸出範例
回應outputs · 4.0 KB · 84 行
[
  {
    "data": {
      "channels": [],
      "completion_suggestions": [],
      "continuation_token": "EqEDEhBkZWVwc2VlayBoYXJuZXNzGowDQ0FBU0FoQUJTQlNDQVF0T1VFOHlRM2RJYm1adFNZSUJDM0ZuT1VWNVIwOWFaRGxWZ2dFTGRXRm5YMlp1UjNsb01UQ0NBUXRCY1c0M1JWQTRjMmhLZDRJQkN6VkhYMkZtYjFSQ01XZHpnZ0VMZVdsWVUwczNWM1pUZGpDQ0FRdHFXVVJXY2kxTE5raFpNSUlCQzA0NVJUQnZZMVZWV0RRNGdnRUxXV3R1TTJGUmFUZDROMi1DQVF0aU4ydHJOelk0U2tWM2M0SUJDM2QyWVZkblJuY3Rlamc0Z2dFTGVHVXRZVWhLVEVNMVZWV0NBUXRNYkhZeFYwbEhlV1ZuT0lJQkMzbDZVMGhuVkZCb2REWmpnZ0VMYXpKb2FURTJlVFkzU20tQ0FRdE5RMnh4ZVVsRWNHaGlZNElCQzBkYWMxVk1UWEV4V1RsRmdnRUxOblUxZDJGb01FSndRa1dDQVF0cE1XTXlhRUpxT0RCcFFZSUJDMWxCZFRSa05EWnViWHBOc2dFR0NnUUlGQkFDGIHg6BgiC3NlYXJjaC1mZWVk",
      "keyword": "deepseek harness",
      "playlists": [],
      "shorts": [],
      "videos": [
        {
          "author": "Prompt Engineering",
          "channel_id": "UCDq7SjbgRKty5TgGafW8Clg",
          "description_snippet": "DeepSeek V4 Pro (GA) is here along with the DeepSeek Harness (this is the important one!): https://deepseek.com/harness/en/ ...",
          "duration": "12:42",
          "published_time": "1 day ago",
          "thumbnails": [
            {
              "height": 202,
              "url": "https://i.ytimg.com/vi/NPO2CwHnfmI/hq720.jpg?sqp=-oaymwEjCOgCEMoBSFryq4qpAxUIARUAAAAAGAElAADIQj0AgKJDeAE=&rs=AOn4CLB2XOOWgUKHMZ6JxVIKEjCTg0BHfw",
              "width": 360
            },
            {
              "height": 404,
              "url": "https://i.ytimg.com/vi/NPO2CwHnfmI/hq720.jpg?sqp=-oaymwEXCNAFEJQDSFryq4qpAwkIARUAAIhCGAE=&rs=AOn4CLC0K2btZkYY3HaBqZ4RMHzmFS7tZg",
              "width": 720
            }
          ],
          "title": "DeepSeek Harness - Its a Big Deal!",
          "url": "https://www.youtube.com/watch?v=NPO2CwHnfmI",
          "video_id": "NPO2CwHnfmI",
          "view_count": "22,082 views"
        },
        {
          "author": "NeuralNine",
          "channel_id": "UC8wZnXYK_CGKlBcZp-GxYPA",
          "description_snippet": "Need some help with a project or some consulting? Contact me here: https://www.neuralnine.com/services The Python Bible ...",
          "duration": "13:32",
          "published_time": "1 day ago",
          "thumbnails": [
            {
              "height": 202,
              "url": "https://i.ytimg.com/vi/qg9EyGOZd9U/hq720.jpg?sqp=-oaymwEjCOgCEMoBSFryq4qpAxUIARUAAAAAGAElAADIQj0AgKJDeAE=&rs=AOn4CLCIEYH7L_5qcK-G_KNDnZ-hJNYsbA",
              "width": 360
            },
            {
              "height": 404,
              "url": "https://i.ytimg.com/vi/qg9EyGOZd9U/hq720.jpg?sqp=-oaymwEXCNAFEJQDSFryq4qpAwkIARUAAIhCGAE=&rs=AOn4CLBu2Ebu9Lrx1JM3OG0PFzRGmrPiDg",
              "width": 720
            }
          ],
          "title": "DeepSeek Harness: The End of Claude Code?",
          "url": "https://www.youtube.com/watch?v=qg9EyGOZd9U",
          "video_id": "qg9EyGOZd9U",
          "view_count": "51,704 views"
        },
        {
          "author": "Julian Goldie SEO",
          "channel_id": "UCGpsgNbzdF7BECCVbB1COHw",
          "description_snippet": "Get the Agent OS & DeepSeek Harness Masterclass https://www.skool.com/ai-profit-lab-7462/about Want to make money and ...",
          "duration": "12:23",
          "published_time": "11 hours ago",
          "thumbnails": [
            {
              "height": 202,
              "url": "https://i.ytimg.com/vi/uag_fnGyh10/hq720_custom_1.jpg?sqp=CNDFgdQG-oaymwEjCOgCEMoBSFryq4qpAxUIARUAAAAAGAElAADIQj0AgKJDeAE=&rs=AOn4CLBYL4uXeMQKzlJyTc8cw-vJPUevZg",
              "width": 360
            },
            {
              "height": 404,
              "url": "https://i.ytimg.com/vi/uag_fnGyh10/hq720_custom_1.jpg?sqp=CNDFgdQG-oaymwEXCNAFEJQDSFryq4qpAwkIARUAAIhCGAE=&rs=AOn4CLBN6N1LphgnTfaI8BmSWFE5Gu-_wQ",
              "width": 720
            }
          ],
          "title": "DeepSeek's New AI Harness Changes Everything",
          "url": "https://www.youtube.com/watch?v=uag_fnGyh10",
          "video_id": "uag_fnGyh10",
          "view_count": "7,587 views"
        },
        "… 17 more items in the full response"
      ]
    }
  }
]

範例

選擇一個範例,將其輸入與結果載入 playground。

API README

YouTube General Search (Web V2, V2) API

Returns YouTube search results for a keyword, grouped into videos, channels, playlists and shorts. The only required input is keyword. Optional filters narrow results by type, upload date, duration, features and sort order.

Use cases

  • Build a list of top tutorial videos for a topic, with titles, authors, durations and links.
  • Track which channels rank for a keyword by reading author and channel_id on each video.
  • Find recent uploads on a subject by combining upload_date with sort_by.
  • Collect thumbnails and description snippets to show search previews in your own app.

Request

curl -X POST "https://api.sandbase.ai/v1/api/youtube/web-v2/general-search-v2" \
  -H "Authorization: Bearer $SANDBASE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"keyword": "Python tutorial"}'

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

Parameters

NameTypeRequiredDescription
continuation_tokenstringNoPagination token (pass from previous response for next page)
durationstringNoVideo duration filter - short(<4min)/medium(4-20min)/long(>20min)
featuresstringNoFeature filter (comma separated) - live/4k/hd/subtitles/creative_commons/360/vr180/3d/hdr
keywordstringNoSearch keyword (required for first request)
sort_bystringNoSort by - relevance/upload_date/view_count/rating
typestringNoResult type filter - video/channel/playlist/movie
upload_datestringNoUpload date filter - last_hour/today/this_week/this_month/this_year

Example response

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

{
  "channels": [],
  "completion_suggestions": [],
  "continuation_token": "EvIEEg9Q…",
  "keyword": "Python tutorial",
  "playlists": [],
  "shorts": [],
  "videos": [
    {
      "author": "Indently",
      "channel_id": "UCuudpdbKmQWq2PPzYgVCWlA",
      "description_snippet": "In this crash course I'll be teaching you the basics of Python in less than 10 m…",
      "duration": "10:30",
      "published_time": "5 years ago",
      "thumbnails": [
        {
          "height": 202,
          "url": "https://i.ytimg.com/vi/fWjsdhR3z3c/hq720.jpg?sqp=-oaymwEjCOgCEMoBSFryq4qpAxUIARU…",
          "width": 360
        }
      ],
      "title": "Learn Python in Less than 10 Minutes for Beginners (Fast & Easy)",
      "url": "https://www.youtube.com/watch?v=fWjsdhR3z3c",
      "video_id": "fWjsdhR3z3c",
      "view_count": "1,897,558 views"
    }
  ]
}

Response fields

FieldMeaning
videos[].titleTitle of the video.
videos[].video_id / videos[].urlThe video ID and the full watch URL for the video.
videos[].author / videos[].channel_idName of the channel that posted the video and its channel ID.
videos[].description_snippetShort, cut-off excerpt of the video description.
videos[].durationVideo length as text, for example 10:30.
videos[].published_timeRelative upload age as text, for example 3 months ago. It is not an exact date.
videos[].view_countView count as display text, for example 1,897,558 views. Parse it before you do math.
videos[].thumbnails[].url / videos[].thumbnails[].width / videos[].thumbnails[].heightThumbnail image links with their pixel sizes.
continuation_tokenToken to pass in the next request to get the following page of results.
channels / playlists / shortsLists of matching channels, playlists and shorts. They were empty in this response, which used the default search.

Notes

  • keyword is required for the first request. For later pages, send the continuation_token from the previous response.
  • Set type to channel or playlist to fill those lists instead of videos.
  • duration accepts short, medium or long. sort_by accepts relevance, upload_date, view_count or rating.
  • Pass a channel_id to YouTube Channel Videos, or a video_id to YouTube Video Information (V2), for more detail.

Pricing

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

探索更多

相關 APIs

所有 APIs
API價格回應
YouTube每次呼叫 $0.002JSON
YouTube每次呼叫 $0.001JSON
YouTube每次呼叫 $0.001JSON
YouTube每次呼叫 $0.001JSON
YouTube每次呼叫 $0.001JSON
YouTube每次呼叫 $0.001JSON

指南:Best YouTube API in 2026: Pricing Compared

問題

常見問題

我要如何使用 YouTube General Search (Web V2, V2) API?

使用 POST 請求將您的 SandBase API 金鑰放在 Authorization 標頭(Bearer)中,並以 JSON 主體傳入參數,即可呼叫 https://api.sandbase.ai/v1/api/youtube/web-v2/general-search-v2。您也可以直接在本頁的 Playground 試用,不必撰寫程式碼。

YouTube General Search (Web V2, V2) API 的費用是多少?

每次 $0.002,並從您的 SandBase 餘額中扣款。您只會為實際發出的呼叫付費;沒有訂閱方案。

YouTube General Search (Web V2, V2) API 接受哪些參數?

不需要任何參數。 選填:continuation_token (any), duration (any), features (any), keyword (any), sort_by (any) 和 type (any),以及另外 1 個。 本頁的 Parameters 表格與 Playground 會列出每個欄位。

YouTube General Search (Web V2, V2) API 會回傳什麼?

在同一個 HTTP 請求中回傳的 JSON 回應(同步)。 本頁的 README 包含範例回應。

我需要 YouTube 開發者帳號或 API 金鑰嗎?

不需要。YouTube General Search (Web V2, V2) 是透過 SandBase 運作,因此一組 SandBase API 金鑰即可使用此端點以及目錄中的其他所有 API 和模型。您不需要另外申請 YouTube API 存取權。