curl --request POST \
--url https://api.aisa.one/apis/v1/brave/news/search \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"q": "<string>",
"search_lang": "en",
"ui_lang": "en-US",
"country": "US",
"safesearch": "",
"count": 20,
"offset": 0,
"spellcheck": "",
"freshness": "",
"extra_snippets": true,
"goggles": "<string>",
"include_fetch_metadata": "",
"operators": ""
}
'import requests
url = "https://api.aisa.one/apis/v1/brave/news/search"
payload = {
"q": "<string>",
"search_lang": "en",
"ui_lang": "en-US",
"country": "US",
"safesearch": "",
"count": 20,
"offset": 0,
"spellcheck": "",
"freshness": "",
"extra_snippets": True,
"goggles": "<string>",
"include_fetch_metadata": "",
"operators": ""
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
q: '<string>',
search_lang: 'en',
ui_lang: 'en-US',
country: 'US',
safesearch: '',
count: 20,
offset: 0,
spellcheck: '',
freshness: '',
extra_snippets: true,
goggles: '<string>',
include_fetch_metadata: '',
operators: ''
})
};
fetch('https://api.aisa.one/apis/v1/brave/news/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/brave/news/search",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'q' => '<string>',
'search_lang' => 'en',
'ui_lang' => 'en-US',
'country' => 'US',
'safesearch' => '',
'count' => 20,
'offset' => 0,
'spellcheck' => '',
'freshness' => '',
'extra_snippets' => true,
'goggles' => '<string>',
'include_fetch_metadata' => '',
'operators' => ''
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.aisa.one/apis/v1/brave/news/search"
payload := strings.NewReader("{\n \"q\": \"<string>\",\n \"search_lang\": \"en\",\n \"ui_lang\": \"en-US\",\n \"country\": \"US\",\n \"safesearch\": \"\",\n \"count\": 20,\n \"offset\": 0,\n \"spellcheck\": \"\",\n \"freshness\": \"\",\n \"extra_snippets\": true,\n \"goggles\": \"<string>\",\n \"include_fetch_metadata\": \"\",\n \"operators\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
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/brave/news/search")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"q\": \"<string>\",\n \"search_lang\": \"en\",\n \"ui_lang\": \"en-US\",\n \"country\": \"US\",\n \"safesearch\": \"\",\n \"count\": 20,\n \"offset\": 0,\n \"spellcheck\": \"\",\n \"freshness\": \"\",\n \"extra_snippets\": true,\n \"goggles\": \"<string>\",\n \"include_fetch_metadata\": \"\",\n \"operators\": \"\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aisa.one/apis/v1/brave/news/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"q\": \"<string>\",\n \"search_lang\": \"en\",\n \"ui_lang\": \"en-US\",\n \"country\": \"US\",\n \"safesearch\": \"\",\n \"count\": 20,\n \"offset\": 0,\n \"spellcheck\": \"\",\n \"freshness\": \"\",\n \"extra_snippets\": true,\n \"goggles\": \"<string>\",\n \"include_fetch_metadata\": \"\",\n \"operators\": \"\"\n}"
response = http.request(request)
puts response.read_body{
"query": {
"original": "<string>",
"altered": "<string>",
"cleaned": "<string>",
"spellcheck_off": true,
"show_strict_warning": true,
"search_operators": {
"applied": false,
"cleaned_query": "<string>",
"sites": [
"<string>"
]
}
},
"type": "news",
"results": []
}News Search
curl --request POST \
--url https://api.aisa.one/apis/v1/brave/news/search \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"q": "<string>",
"search_lang": "en",
"ui_lang": "en-US",
"country": "US",
"safesearch": "",
"count": 20,
"offset": 0,
"spellcheck": "",
"freshness": "",
"extra_snippets": true,
"goggles": "<string>",
"include_fetch_metadata": "",
"operators": ""
}
'import requests
url = "https://api.aisa.one/apis/v1/brave/news/search"
payload = {
"q": "<string>",
"search_lang": "en",
"ui_lang": "en-US",
"country": "US",
"safesearch": "",
"count": 20,
"offset": 0,
"spellcheck": "",
"freshness": "",
"extra_snippets": True,
"goggles": "<string>",
"include_fetch_metadata": "",
"operators": ""
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
q: '<string>',
search_lang: 'en',
ui_lang: 'en-US',
country: 'US',
safesearch: '',
count: 20,
offset: 0,
spellcheck: '',
freshness: '',
extra_snippets: true,
goggles: '<string>',
include_fetch_metadata: '',
operators: ''
})
};
fetch('https://api.aisa.one/apis/v1/brave/news/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/brave/news/search",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'q' => '<string>',
'search_lang' => 'en',
'ui_lang' => 'en-US',
'country' => 'US',
'safesearch' => '',
'count' => 20,
'offset' => 0,
'spellcheck' => '',
'freshness' => '',
'extra_snippets' => true,
'goggles' => '<string>',
'include_fetch_metadata' => '',
'operators' => ''
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.aisa.one/apis/v1/brave/news/search"
payload := strings.NewReader("{\n \"q\": \"<string>\",\n \"search_lang\": \"en\",\n \"ui_lang\": \"en-US\",\n \"country\": \"US\",\n \"safesearch\": \"\",\n \"count\": 20,\n \"offset\": 0,\n \"spellcheck\": \"\",\n \"freshness\": \"\",\n \"extra_snippets\": true,\n \"goggles\": \"<string>\",\n \"include_fetch_metadata\": \"\",\n \"operators\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
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/brave/news/search")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"q\": \"<string>\",\n \"search_lang\": \"en\",\n \"ui_lang\": \"en-US\",\n \"country\": \"US\",\n \"safesearch\": \"\",\n \"count\": 20,\n \"offset\": 0,\n \"spellcheck\": \"\",\n \"freshness\": \"\",\n \"extra_snippets\": true,\n \"goggles\": \"<string>\",\n \"include_fetch_metadata\": \"\",\n \"operators\": \"\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aisa.one/apis/v1/brave/news/search")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"q\": \"<string>\",\n \"search_lang\": \"en\",\n \"ui_lang\": \"en-US\",\n \"country\": \"US\",\n \"safesearch\": \"\",\n \"count\": 20,\n \"offset\": 0,\n \"spellcheck\": \"\",\n \"freshness\": \"\",\n \"extra_snippets\": true,\n \"goggles\": \"<string>\",\n \"include_fetch_metadata\": \"\",\n \"operators\": \"\"\n}"
response = http.request(request)
puts response.read_body{
"query": {
"original": "<string>",
"altered": "<string>",
"cleaned": "<string>",
"spellcheck_off": true,
"show_strict_warning": true,
"search_operators": {
"applied": false,
"cleaned_query": "<string>",
"sites": [
"<string>"
]
}
},
"type": "news",
"results": []
}授权
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
请求头
The default supported media type is application/json.
application/json, */* "application/json"
The API version to use. This is denoted by the format YYYY-MM-DD. Default is the latest that is available. Read more about API versioning.
Brave Search will return cached content by default. To prevent caching set the Cache-Control header to no-cache. This is currently done as best effort.
no-cache "no-cache"The user agent originating the request. Brave search can utilize the user agent to provide a different experience depending on the device as described by the string. The user agent should follow the commonly used browser agent strings on each platform. For more information on curating user agents, see RFC 9110.
请求体
The user’s search query term. Query can not be empty. Maximum of 400 characters and 50 words in the query.
1 - 400The search language preference. The 2 or more character language code for which the search results are provided.
ar, eu, bn, bg, ca, zh-hans, zh-hant, hr, cs, da, nl, en, en-gb, et, fi, fr, gl, de, el, gu, he, hi, hu, is, it, ja, jp, kn, ko, lv, lt, ms, ml, mr, nb, pl, pt-br, pt-pt, pa, ro, ru, sr, sk, sl, es, sv, ta, te, th, tr, uk, vi User interface language preferred in response. Usually of the format <language_code>-<country_code>. For more, see RFC 9110.
es-AR, en-AU, de-AT, nl-BE, fr-BE, pt-BR, en-CA, fr-CA, es-CL, da-DK, fi-FI, fr-FR, de-DE, el-GR, zh-HK, en-IN, en-ID, it-IT, ja-JP, ko-KR, en-MY, es-MX, nl-NL, en-NZ, no-NO, zh-CN, pl-PL, en-PH, ru-RU, en-ZA, es-ES, sv-SE, fr-CH, de-CH, zh-TW, tr-TR, en-GB, en-US, es-US The search query country, where the results come from. The country string is limited to 2 character country codes of supported countries or ALL for worldwide.
AR, AU, AT, BE, BR, CA, CL, DK, FI, FR, DE, GR, HK, IN, ID, IT, JP, KR, MY, MX, NL, NZ, NO, CN, PL, PT, PH, RU, SA, ZA, ES, SE, CH, TW, TR, GB, US, ALL Filters search results for adult content. The following values are supported:
- off - No filtering is done.
- moderate - Filter out explicit content.
- strict - Filter out explicit and suggestive content.
off, moderate, strict ""
The number of search results returned in response. The maximum is 50. The actual number delivered may be less than requested. Combine this parameter with offset to paginate search results.
1 <= x <= 50The zero based offset that indicates number of search results per page (count) to skip before returning the result. The maximum is 9. The actual number delivered may be less than requested based on the query. In order to paginate results use this parameter together with count. For example, if your user interface displays 20 search results per page, set count to 20 and offset to 0 to show the first page of results. To get subsequent pages, increment offset by 1 (e.g. 0, 1, 2). The results may overlap across multiple pages.
0 <= x <= 9Whether to spell check the provided query. If the spellchecker is enabled, the modified query is always used for search. The modified query can be found in altered key from the query response model.
""
true
false
Filters search results by page age. The age of a page is determined by the most relevant date reported by the content, such as its published or last modified date. The following values are supported:
- pd - Pages aged 24 hours or less.
- pw - Pages aged 7 days or less.
- pm - Pages aged 31 days or less.
- py - Pages aged 365 days or less.
- YYYY-MM-DDtoYYYY-MM-DD - A custom date range is also supported by specifying start and end dates e.g.
2022-04-01to2022-07-30.
""
"pm"
"2022-04-01to2022-07-30"
A snippet is an excerpt from a page you get as a result of the query, and extra_snippets allow you to get up to 5 additional, alternative excerpts.
Goggles act as a custom re-ranking on top of Brave’s search index. The parameter supports both a url where the Goggle is hosted or the definition of the Goggle. For more details, see the Goggles documentation. The parameter can be a single Goggle or a list of up to 3 Goggles.
Include fetch metadata.
""
true
false
Whether to apply search operators.
""
true
false