结合网页和学术结果的智能搜索
curl --request POST \
--url https://api.aisa.one/apis/v1/scholar/search/mixed \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.aisa.one/apis/v1/scholar/search/mixed"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.aisa.one/apis/v1/scholar/search/mixed', 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/scholar/search/mixed",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
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/scholar/search/mixed"
req, _ := http.NewRequest("POST", 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.post("https://api.aisa.one/apis/v1/scholar/search/mixed")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aisa.one/apis/v1/scholar/search/mixed")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "<string>",
"results": [
{
"title": "<string>",
"link": "<string>",
"snippet": "<string>",
"authors": [
"<string>"
],
"number_of_citations": 1,
"type": "web",
"relevance_score": 0.5
}
],
"search_type": "web"
}{
"error": "<string>",
"code": 123,
"details": "<string>"
}{
"error": "<string>",
"code": 123,
"details": "<string>"
}{
"error": "<string>",
"code": 123,
"details": "<string>"
}{
"error": "<string>",
"code": 123,
"details": "<string>"
}学术搜索 API
智能搜索
同时搜索网页与学术来源,适合跨在两边的问题。
POST
https://api.aisa.one/apis/v1
/
scholar
/
search
/
mixed
结合网页和学术结果的智能搜索
curl --request POST \
--url https://api.aisa.one/apis/v1/scholar/search/mixed \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.aisa.one/apis/v1/scholar/search/mixed"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.aisa.one/apis/v1/scholar/search/mixed', 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/scholar/search/mixed",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
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/scholar/search/mixed"
req, _ := http.NewRequest("POST", 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.post("https://api.aisa.one/apis/v1/scholar/search/mixed")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aisa.one/apis/v1/scholar/search/mixed")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "<string>",
"results": [
{
"title": "<string>",
"link": "<string>",
"snippet": "<string>",
"authors": [
"<string>"
],
"number_of_citations": 1,
"type": "web",
"relevance_score": 0.5
}
],
"search_type": "web"
}{
"error": "<string>",
"code": 123,
"details": "<string>"
}{
"error": "<string>",
"code": 123,
"details": "<string>"
}{
"error": "<string>",
"code": 123,
"details": "<string>"
}{
"error": "<string>",
"code": 123,
"details": "<string>"
}同时搜索网页与学术来源,适合跨在两边的问题。⚠️ 参数放在 query string 里:
query(必填)、max_num_results、as_ylo/as_yhi。返回一个检索 id 和 results[];条目形状随来源变化 —— 每条都有 title、link、snippet,学术来源的还额外带 authors 和 number_of_citations,所以把这两个字段当作可选的,不要默认它们存在。实测约 3 秒。当你事先不知道哪类来源能回答时用它。已经知道的话,post_scholar_search_web 或 post_scholar_search_scholar 的返回更可预期。记住 id,post_scholar_search_explain 要用。授权
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
查询参数
学术资料搜索查询
示例:
"machine learning"
返回的搜索结果最大数量,最多 100 条
必填范围:
1 <= x <= 100出版年份下限
必填范围:
1900 <= x <= 2030出版年份上限
必填范围:
1900 <= x <= 2030