跳转到主要内容
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>"
  }
}

授权

Authorization
string
header
必填

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

查询参数

engine
enum<string>
必填

SearchApi 引擎标识符。此 YouTube 端点使用 youtube

可用选项:
youtube
q
string
必填

搜索查询。运行时和上游 SearchApi 必填。

sp
string

YouTube 筛选 token(分页或高级筛选)

gl
string

国家/地区代码(例如 us、jp)

hl
string

界面语言

响应

YouTube 搜索成功响应

SearchApi 通过 AIsa 封装器返回的 YouTube 搜索结果载荷。

search_metadata
object
search_parameters
object
search_information
object
videos
object[]
channels
object[]
shorts
object[]
sections
object[]
playlists
object[]
ads
object[]
pagination
object