# Youtube - 综合搜索V2

所属目录：Youtube

文档地址：https://doc.getoneapi.com/479723426e0

`POST https://api.getoneapi.com/api/youtube/search_v2`

## 鉴权

在请求头中传递 Authorization: Bearer YOUR_API_KEY（必填）

## 请求参数

### Header 参数

| 字段 | 类型 | 必填 | 说明 |
| --- | --- | --- | --- |
| Authorization | string | 是 | 在 Header 添加参数 Authorization，其值为在 Bearer 之后拼接 apikey<br><br>默认值： Bearer YOUR_API_KEY |
| Content-Type | string | 是 | 默认值： application/json |

### Body 参数 · application/json

| 字段 | 类型 | 必填 | 说明 |
| --- | --- | --- | --- |
| keyword | string | 是 | 搜索关键词<br> |
| continuation_token | string | 否 | 分页token（获取下一页时传入，从上一次返回结果中获取） |
| upload_date | string | 否 | 上传时间过滤 - last_hour/today/this_week/this_month/this_year |
| type | string | 否 | 结果类型过滤 - video/channel/playlist/movie |
| duration | string | 否 | 视频时长过滤 - short(&lt;4分钟)/medium(4-20分钟)/long(&gt;20分钟) |
| features | string | 否 | 特性过滤（多个用逗号分隔）- live/4k/hd/subtitles/creative_commons/360/vr180/3d/hdr |
| sort_by | string | 否 | 排序方式 - relevance(相关性)/upload_date(上传日期)/view_count(播放量)/rating(评分) |

#### JSON Schema

```json
{
  "type" : "object",
  "properties" : {
    "keyword" : {
      "type" : "string",
      "title" : "搜索关键词"
    },
    "continuation_token" : {
      "type" : "string",
      "description" : "分页token（获取下一页时传入，从上一次返回结果中获取）"
    },
    "upload_date" : {
      "type" : "string",
      "description" : "上传时间过滤 - last_hour/today/this_week/this_month/this_year"
    },
    "type" : {
      "type" : "string",
      "description" : "结果类型过滤 - video/channel/playlist/movie"
    },
    "duration" : {
      "type" : "string",
      "description" : "视频时长过滤 - short(<4分钟)/medium(4-20分钟)/long(>20分钟)"
    },
    "features" : {
      "type" : "string",
      "description" : "特性过滤（多个用逗号分隔）- live/4k/hd/subtitles/creative_commons/360/vr180/3d/hdr"
    },
    "sort_by" : {
      "type" : "string",
      "description" : "排序方式 - relevance(相关性)/upload_date(上传日期)/view_count(播放量)/rating(评分)"
    }
  },
  "required" : [ "keyword" ]
}
```

#### 示例

```json
{
  "keyword" : "老高",
  "continuation_token" : "",
  "upload_date" : "",
  "type" : "",
  "duration" : "",
  "features" : "",
  "sort_by" : ""
}
```

## 返回响应

### 响应 200 · application/json

| 字段 | 类型 | 必填 | 说明 |
| --- | --- | --- | --- |
| code | integer | 是 |  |
| message | string | 是 |  |
| data | object | 是 |  |

#### JSON Schema

```json
{
  "type" : "object",
  "properties" : {
    "code" : {
      "type" : "integer"
    },
    "message" : {
      "type" : "string"
    },
    "data" : {
      "type" : "object",
      "properties" : { }
    }
  },
  "required" : [ "code", "message", "data" ]
}
```

#### 示例

```json
{
  "code" : 200,
  "message" : "success",
  "data" : { }
}
```

## 请求示例代码

```sh
curl --globoff --request POST 'https://api.getoneapi.com/api/youtube/search_v2' \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
  "keyword" : "老高",
  "continuation_token" : "",
  "upload_date" : "",
  "type" : "",
  "duration" : "",
  "features" : "",
  "sort_by" : ""
}'
```

