Video Search API
Search videos across YouTube and Google Videos with filtering, geographic targeting, and pagination support.
POST
/v1/video/*YouTube 搜索
POST
/v1/video/youtube按关键词搜索 YouTube 视频,支持国家、语言和分页/过滤。
参数
| 参数 | 类型 | 必填 | 描述 |
|---|---|---|---|
q | string | 必填 | 搜索关键词 |
country | string | 可选 | 国家代码过滤 |
language | string | 可选 | 语言过滤 |
sp | string | 可选 | 分页/过滤参数 |
Google 视频搜索
POST
/v1/video/google-videos在 Google 上搜索视频,支持地理定位、时间过滤、语言设置和安全搜索。
参数
| 参数 | 类型 | 必填 | 描述 |
|---|---|---|---|
q | string | 必填 | 搜索关键词 |
location | string | 可选 | 地理定位 |
language | string | 可选 | 语言过滤 |
page | integer | 可选 (默认: 0) | 分页页码 |
safe | string | 可选 | 安全搜索设置 |
响应
Response
{
"success": true,
"message": "YouTube search completed successfully",
"data": {
"video_results": [
{
"title": "Transformers Explained - Machine Learning",
"channel": "3Blue1Brown",
"views": "5.2M views",
"published": "1 year ago",
"link": "https://youtube.com/watch?v=...",
"thumbnail": "https://i.ytimg.com/vi/.../hqdefault.jpg"
}
]
}
}示例
import requests
API_KEY = "your_api_key_here"
BASE_URL = "https://api.qinyanai.com"
# YouTube search
response = requests.post(
f"{BASE_URL}/v1/video/youtube",
headers={"Authorization": f"Bearer {API_KEY}"},
json={"q": "transformer architecture explained", "country": "US"}
)
# Google Videos search
response = requests.post(
f"{BASE_URL}/v1/video/google-videos",
headers={"Authorization": f"Bearer {API_KEY}"},
json={"q": "deep learning tutorial", "language": "en"}
)