YouTube 搜索
curl --request GET \
--url https://api.aisa.one/apis/v1/youtube/search \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.aisa.one/apis/v1/youtube/search"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.aisa.one/apis/v1/youtube/search', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.aisa.one/apis/v1/youtube/search",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.aisa.one/apis/v1/youtube/search"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.aisa.one/apis/v1/youtube/search")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aisa.one/apis/v1/youtube/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"search_metadata": {
"id": "<string>",
"status": "<string>",
"created_at": "<string>",
"request_time_taken": 123,
"parsing_time_taken": 123,
"total_time_taken": 123,
"request_url": "<string>",
"html_url": "<string>",
"json_url": "<string>"
},
"search_parameters": {},
"search_information": {
"total_results": 123
},
"videos": [
{
"position": 123,
"id": "<string>",
"title": "<string>",
"link": "<string>",
"description": "<string>",
"thumbnail": "<string>",
"published_time": "<string>",
"length": "<string>",
"views": 123,
"channel": {},
"is_live": true,
"badges": [
"<string>"
]
}
],
"channels": [
{
"position": 123,
"id": "<string>",
"title": "<string>",
"link": "<string>",
"description": "<string>",
"thumbnail": "<string>",
"subscribers": "<string>"
}
],
"shorts": [
{
"position": 123,
"section_title": "<string>",
"items": [
{}
]
}
],
"sections": [
{
"position": 123,
"section_title": "<string>",
"items": [
{}
]
}
],
"playlists": [
{}
],
"ads": [
{}
],
"pagination": {
"next_page_token": "<string>"
}
}搜索 API
YouTube 搜索 API
搜索 YouTube,返回匹配的视频、频道和播放列表。
GET
https://api.aisa.one/apis/v1
/
youtube
/
search
YouTube 搜索
curl --request GET \
--url https://api.aisa.one/apis/v1/youtube/search \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.aisa.one/apis/v1/youtube/search"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.aisa.one/apis/v1/youtube/search', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.aisa.one/apis/v1/youtube/search",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.aisa.one/apis/v1/youtube/search"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.aisa.one/apis/v1/youtube/search")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aisa.one/apis/v1/youtube/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"search_metadata": {
"id": "<string>",
"status": "<string>",
"created_at": "<string>",
"request_time_taken": 123,
"parsing_time_taken": 123,
"total_time_taken": 123,
"request_url": "<string>",
"html_url": "<string>",
"json_url": "<string>"
},
"search_parameters": {},
"search_information": {
"total_results": 123
},
"videos": [
{
"position": 123,
"id": "<string>",
"title": "<string>",
"link": "<string>",
"description": "<string>",
"thumbnail": "<string>",
"published_time": "<string>",
"length": "<string>",
"views": 123,
"channel": {},
"is_live": true,
"badges": [
"<string>"
]
}
],
"channels": [
{
"position": 123,
"id": "<string>",
"title": "<string>",
"link": "<string>",
"description": "<string>",
"thumbnail": "<string>",
"subscribers": "<string>"
}
],
"shorts": [
{
"position": 123,
"section_title": "<string>",
"items": [
{}
]
}
],
"sections": [
{
"position": 123,
"section_title": "<string>",
"items": [
{}
]
}
],
"playlists": [
{}
],
"ads": [
{}
],
"pagination": {
"next_page_token": "<string>"
}
}搜索 YouTube,返回匹配的视频、频道和播放列表。需设置
engine=youtube 并在 q 中传入查询词;两者均为必填。可选地按国家(gl)和界面语言(hl)收窄,或在 sp 中传入 YouTube 筛选 token 以实现分页和上传日期、时长、结果类型等高级筛选。适合用于查找某个话题的视频内容、跟踪某频道的近期上传,或评估某主题的视频覆盖度。
注意:该接口通过 AIsa 映射路径 /apis/v1/youtube/search 提供服务;上游提供商的原生路径并未直接挂载。授权
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
查询参数
SearchApi 引擎标识符。此 YouTube 端点使用 youtube。
可用选项:
youtube 搜索查询。运行时和上游 SearchApi 必填。
YouTube 筛选 token(分页或高级筛选)
国家/地区代码(例如 us、jp)
界面语言
响应
YouTube 搜索成功响应
SearchApi 通过 AIsa 封装器返回的 YouTube 搜索结果载荷。
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
⌘I