跳到主要内容
YouTube 全部接口
搜索YouTube视频 · 搜索

YouTube 视频搜索

按关键词分页搜索 YouTube 公开视频,可按上传时间、时长和排序方式筛选。

POST/v1/youtube/videos/search

英文名称: YouTube video search · Video · Search Page through public YouTube videos for a keyword, filtered by upload date and duration and sorted as chosen.
youtube.videos.search@v1

按次价格

¥0.02/ 次

非空完整结果收费;空结果、部分结果和失败不收费。

正在核验实时状态

在线试用

登录后用真实参数调用一次,结果和扣费会显示在这里。

安全验证

正在加载安全验证…

正在确认实时执行状态…

执行结果

// Result

请求参数

keywordstring必填

minLength: 1 · maxLength: 100

示例: "python tutorial"

upload_datestring可选

enum: "last_hour" | "today" | "this_week" | "this_month" | "this_year"

示例: "this_month"

durationstring可选

enum: "short" | "medium" | "long"

sort_bystring可选

enum: "relevance" | "upload_date" | "view_count" | "rating" · default: "relevance"

示例: "view_count"

cursorstring可选

minLength: 1

请求 JSON Schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "keyword": {
      "type": "string",
      "minLength": 1,
      "maxLength": 100
    },
    "upload_date": {
      "type": "string",
      "enum": [
        "last_hour",
        "today",
        "this_week",
        "this_month",
        "this_year"
      ]
    },
    "duration": {
      "type": "string",
      "enum": [
        "short",
        "medium",
        "long"
      ]
    },
    "sort_by": {
      "default": "relevance",
      "type": "string",
      "enum": [
        "relevance",
        "upload_date",
        "view_count",
        "rating"
      ]
    },
    "cursor": {
      "type": "string",
      "minLength": 1
    }
  },
  "required": [
    "keyword"
  ],
  "additionalProperties": false
}

代码示例

安装 SDK:npm i @dataxapi/sdk 或 pip install dataxapi;把 API Key 放进环境变量 DATAXAPI_API_KEY。

curl -X POST https://api.dataxapi.com/v1/youtube/videos/search \
  -H "Authorization: Bearer $DATAXAPI_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"keyword":"python tutorial","upload_date":"this_month","sort_by":"view_count"}'

返回示例

200 · application/json
{
  "code": 200,
  "request_id": "req_example_youtube_videos_search",
  "message": "success",
  "data": {
    "items": [
      {
        "video_id": "rfscVS0vtbw",
        "title": "Learn Python - Full Course for Beginners",
        "duration": "4:26:52",
        "view_count": "48M views",
        "published_time": "7 years ago",
        "author": "freeCodeCamp.org",
        "channel_id": "UC8butISFwT-Wl7EV0hUK0BQ"
      }
    ]
  },
  "page": {
    "next_cursor": "cursor_example"
  },
  "warnings": [],
  "meta": {
    "listing_id": "youtube.videos.search",
    "version": "v1",
    "catalog_release_id": "catalog-production-2026-09-19.b069be57",
    "price_book_version": "pricebook-production-2026-09-19.4487e352",
    "result_status": "complete",
    "charged_amount": "0.02",
    "balance_after": "49.98",
    "currency": "CNY"
  }
}
返回字段说明
codenumber
const: 200
request_idstring
messagestring
const: "success"
dataobject
pageobject
warningsarray
metaobject
返回 JSON Schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "code": {
      "type": "number",
      "const": 200
    },
    "request_id": {
      "type": "string"
    },
    "message": {
      "type": "string",
      "const": "success"
    },
    "data": {
      "type": "object",
      "properties": {
        "items": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "video_id": {},
              "title": {},
              "description": {},
              "duration": {},
              "view_count": {},
              "published_time": {},
              "author": {},
              "channel_id": {},
              "url": {}
            },
            "additionalProperties": false
          }
        }
      },
      "required": [
        "items"
      ],
      "additionalProperties": false
    },
    "page": {
      "type": "object",
      "properties": {
        "next_cursor": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "next_cursor"
      ],
      "additionalProperties": false
    },
    "warnings": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "meta": {
      "type": "object",
      "properties": {
        "listing_id": {
          "type": "string",
          "const": "youtube.videos.search"
        },
        "version": {
          "type": "string",
          "const": "v1"
        },
        "catalog_release_id": {
          "type": "string",
          "minLength": 1
        },
        "price_book_version": {
          "type": "string",
          "minLength": 1
        },
        "result_status": {
          "type": "string",
          "enum": [
            "complete",
            "empty",
            "partial"
          ]
        },
        "charged_amount": {
          "type": "string"
        },
        "balance_after": {
          "type": "string"
        },
        "currency": {
          "type": "string",
          "const": "CNY"
        }
      },
      "required": [
        "listing_id",
        "version",
        "catalog_release_id",
        "price_book_version",
        "result_status",
        "charged_amount",
        "balance_after",
        "currency"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "code",
    "request_id",
    "message",
    "data",
    "page",
    "warnings",
    "meta"
  ],
  "additionalProperties": false
}

使用说明

适合

  • 需要围绕关键词发现 YouTube 公开视频和选题。

不适合

  • 不用于频道搜索、Shorts 专项搜索或搜索量估算。

已知限制

  • 只返回视频类结果;同页的 Shorts、频道和播放列表不返回。
  • 播放量和发布时间为平台展示文本。
  • 结果排序由平台决定,不能解释推荐算法或因果关系。
  • 只能用返回的 DataXAPI cursor 继续同一查询。

计费规则

¥0.02 / 次。非空完整结果收费;空结果、部分结果和失败不收费。

查看全部价格 →