跳转到主要内容
GET
https://api.aisa.one/apis/v1
/
reddit
/
search
搜索 Reddit
curl --request GET \
  --url https://api.aisa.one/apis/v1/reddit/search \
  --header 'Authorization: Bearer <token>'
import requests

url = "https://api.aisa.one/apis/v1/reddit/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/reddit/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/reddit/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/reddit/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/reddit/search")
.header("Authorization", "Bearer <token>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.aisa.one/apis/v1/reddit/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
{
  "success": true,
  "posts": [
    {
      "id": "w63dgy",
      "author": "Morgentau7",
      "author_fullname": "t2_2hy2xjit",
      "subreddit": "MadeMeSmile",
      "title": "Player realizes that he nearly stole the dogs job",
      "downs": 0,
      "name": "t3_w63dgy",
      "upvote_ratio": 0.97,
      "ups": 220403,
      "total_awards_received": 0,
      "score": 220403,
      "created": 1658580900,
      "num_comments": 1246,
      "url": "https://www.reddit.com/r/MadeMeSmile/comments/w63dgy/player_realizes_that_he_nearly_stole_the_dogs_job/",
      "subreddit_subscribers": 11605207,
      "is_video": true,
      "created_utc": 1658580900
    }
  ],
  "after": "t3_1izmcgx"
}
在整个 Reddit 中搜索与查询匹配的帖子。

示例

curl "https://api.aisa.one/apis/v1/reddit/search?query=VALUE" \
  -H "Authorization: Bearer YOUR_API_KEY"

授权

Authorization
string
header
必填

AIsa API 密钥。前往 https://aisa.one 获取

查询参数

query
string
必填

搜索查询

sort
enum<string>

排序依据

可用选项:
relevance,
new,
top,
comment_count
timeframe
enum<string>

时间范围

可用选项:
all,
day,
week,
month,
year
after
string

用于分页至下一页

trim
boolean

设为 true 以返回精简版响应

响应

200 - application/json

成功响应

success
boolean
credits_remaining
integer
posts
object[]
after
string | null
cursor
string | null