Reddit API - 搜索 (V1)
根据指定关键词在Reddit上搜索帖子。 检索匹配的帖子及其元数据和基本互动指标。
典型用例
- 发现特定主题的新讨论或趋势
- 竞争情报和品牌监控
- 研究平台上的社区活动
亮点
- 可使用'after'参数对结果进行分页。
请求参数
| 参数名 | 位置 | 类型 | 必填 | 说明 |
|---|---|---|---|---|
token | query | string | 是 | 此 API 服务的访问令牌。 |
keyword | query | string | 是 | 搜索查询关键词。 |
after | query | string | 否 | 用于检索下一组结果的分页令牌。 |
代码示例
💡 环境说明
默认示例使用 https://api.justoneapi.com (prod-global)。中国大陆地区建议替换为 http://47.117.133.51:30015 (prod-cn) 以获得更好的访问体验。详见 环境选择。
bash
# 提示: 中国大陆地区建议将 https://api.justoneapi.com 替换为 http://47.117.133.51:30015
curl -X GET "https://api.justoneapi.com/api/reddit/search/v1?token=YOUR_API_KEY&keyword=VALUE"text
我想使用 Just One API 提供的“搜索 (V1)”接口。
接口地址: https://api.justoneapi.com/api/reddit/search/v1
HTTP 方法: GET
身份验证: 在 URL 后添加查询参数“?token=您的API密钥”。
OpenAPI 定义: https://docs.justoneapi.com/openapi/reddit-apis/search-v1-zh.json
请求参数说明:
- token (query): 此 API 服务的访问令牌。 (必填)
- keyword (query): 搜索查询关键词。 (必填)
- after (query): 用于检索下一组结果的分页令牌。
返回格式: JSON
响应处理与错误码:
1. 需通过返回体中的 "code" 字段判断业务结果(code 为 0 表示成功)。
2. 超时建议:建议将请求超时时间设置为至少 60 秒。
3. 业务码说明:
- 0: 成功
- 100: Token 无效或已失效
- 301: 采集失败,请重试
- 302: 超出速率限制
- 303: 超出每日配额
- 400: 参数错误
- 500: 内部服务器错误
- 600: 权限不足
- 601: 余额不足
请帮我用我擅长的编程语言写一个脚本来调用这个接口,并处理返回结果。python
# 提示: 中国大陆地区建议将 https://api.justoneapi.com 替换为 http://47.117.133.51:30015
import requests
url = "https://api.justoneapi.com/api/reddit/search/v1?token=YOUR_API_KEY&keyword=VALUE"
response = requests.get(url)
print(response.json())js
// 提示: 中国大陆地区建议将 https://api.justoneapi.com 替换为 http://47.117.133.51:30015
const response = await fetch("https://api.justoneapi.com/api/reddit/search/v1?token=YOUR_API_KEY&keyword=VALUE", {
method: "GET"
});
const data = await response.json();
console.log(data);java
// 提示: 中国大陆地区建议将 https://api.justoneapi.com 替换为 http://47.117.133.51:30015
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.justoneapi.com/api/reddit/search/v1?token=YOUR_API_KEY&keyword=VALUE"))
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}go
// 提示: 中国大陆地区建议将 https://api.justoneapi.com 替换为 http://47.117.133.51:30015
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
client := &http.Client{}
url := "https://api.justoneapi.com/api/reddit/search/v1?token=YOUR_API_KEY&keyword=VALUE"
req, _ := http.NewRequest("GET", url, nil)
resp, _ := client.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}php
// 提示: 中国大陆地区建议将 https://api.justoneapi.com 替换为 http://47.117.133.51:30015
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.justoneapi.com/api/reddit/search/v1?token=YOUR_API_KEY&keyword=VALUE");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
$response = curl_exec($ch);
curl_close($ch);
echo $response;响应结果
json
{
"code": 0,
"data": {
"search": {
"dynamic": {
"components": {
"__typename": "SearchResultsMainLayout",
"appliedState": {
"__typename": "SearchAppliedState",
"pane": "posts",
"filters": [
{
"key": "component",
"value": "SearchAppliedState"
}
]
},
"main": {
"edges": [
{
"cursor": "",
"node": {
"__typename": "SearchListComponent",
"presentation": {
"__typename": "SearchListComponentDefaultPresentation",
"isDefaultPresentation": false
},
"behaviors": {
"header": null
},
"children": [
{
"__typename": "SearchPost",
"post": {
"__typename": "SubredditPost",
"id": "t3_1rklhpf",
"createdAt": "2026-03-04T13:31:09.454000+0000",
"editedAt": null,
"postTitle": "Why has Deepseek become basically unusable for me?",
"url": "https://www.reddit.com/r/DeepSeek/comments/1rklhpf/why_has_deepseek_become_basically_unusable_for_me...",
"content": {
"markdown": "It hallucinates at the level of the original chatgpt, is unable to hold any true conversation...like...",
"richtext": "{\"document\":[{\"c\":[{\"e\":\"text\",\"t\":\"It hallucinates at the level of the original chatgpt, is unable ...",
"html": "It hallucinates at the level of the original chatgpt, is unable to hold any true conversation...like...",
"richtextMedia": [],
"preview": "It hallucinates at the level of the original chatgpt, is unable to hold any true conversation...like..."
},
"domain": "self.DeepSeek",
"isSpoiler": false,
"isNsfw": false,
"isCommercialCommunication": false,
"isLocked": false,
"isSaved": false,
"isReactAllowed": false,
"isHidden": false,
"isGildable": true,
"isCrosspostable": true,
"isScoreHidden": false,
"isArchived": false,
"isStickied": false,
"isPollIncluded": false,
"poll": null,
"isFollowed": false,
"awardings": [],
"isContestMode": false,
"distinguishedAs": null,
"voteState": "NONE",
"score": 33,
"commentCount": 19,
"viewCount": null,
"authorFlair": null,
"flair": {
"__typename": "PostFlair",
"type": "text",
"text": "Discussion ",
"richtext": null,
"textColor": "LIGHT",
"template": {
"id": "605c614a-dce7-11ef-9d67-827ccac334c0",
"isEditable": false,
"backgroundColor": "#7A8999"
}
},
"authorInfo": {
"__typename": "Redditor",
"id": "t2_27xtm4u7gy",
"name": "77ChryslerNewYorker",
"isBlocked": false,
"isCakeDayNow": false,
"newIcon": {
"__typename": "MediaSource",
"url": "https://www.redditstatic.com/avatars/defaults/v2/avatar_default_2.png",
"dimensions": {
"width": 256,
"height": 256
}
},
"iconSmall": {
"__typename": "MediaSource",
"url": "https://www.redditstatic.com/avatars/defaults/v2/avatar_default_2.png",
"dimensions": {
"width": 256,
"height": 256
}
},
"snoovatarIcon": null,
"profile": {
"isNsfw": true
},
"accountType": "USER"
},
"isThumbnailEnabled": false,
"thumbnail": null,
"media": null,
"moderationInfo": null,
"suggestedCommentSort": null,
"permalink": "/r/DeepSeek/comments/1rklhpf/why_has_deepseek_become_basically_unusable_for_me/",
"isSelfPost": true,
"postHint": null,
"postEventInfo": null,
"gallery": null,
"subreddit": {
"id": "t5_a5tk5l",
"name": "DeepSeek",
"__typename": "Subreddit",
"prefixedName": "r/DeepSeek",
"isQuarantined": false,
"title": "DeepSeek",
"type": "PUBLIC",
"subscribersCount": 95066,
"isNsfw": false,
"isSubscribed": false,
"isThumbnailsEnabled": true,
"styles": {
"icon": "https://styles.redditmedia.com/t5_a5tk5l/styles/communityIcon_9jaxsiqdd3fe1.jpg?width=64&height=64&f...",
"legacyIcon": null,
"primaryColor": null,
"bannerBackgroundImage": null,
"legacyPrimaryColor": null
},
"modPermissions": null,
"communityStatus": null,
"isTitleSafe": true,
"isUserBanned": false,
"tippingStatus": null,
"whitelistStatus": "ALL_ADS"
},
"outboundLink": {
"url": "https://www.reddit.com/r/DeepSeek/comments/1rklhpf/why_has_deepseek_become_basically_unusable_for_me...",
"expiresAt": "2026-03-09T19:00:04.551132+0000"
},
"upvoteRatio": 0.7704918032786885,
"reactedFrom": null,
"attributionInfo": null,
"crowdControlLevel": "OFF",
"isCrowdControlFilterEnabled": false,
"languageCode": "en",
"isTranslatable": false,
"isTranslated": false,
"translatedLanguage": null,
"removedByCategory": null,
"crosspostRoot": null
},
"behaviors": {
"community": {
"__typename": "SearchCommunityNavigationBehavior",
"id": "t5_a5tk5l",
"name": "DeepSeek",
"telemetry": {
"__typename": "SearchElementTelemetry",
"trackingContext": {
"__typename": "SearchTelemetryTrackingContext",
"search": {
"isNsfw": false,
"range": null,
"safeSearch": "UNAVAILABLE",
"scope": {
"id": null,
"name": null,
"path": "/",
"type": "GLOBAL"
},
"snippet": null,
"snippetId": null,
"sort": null,
"query": "deepseek",
"queryID": "720e3c25-1254-4e09-bf52-bbd49666c5a7"
},
"actionInfo": {
"paneName": "posts",
"position": 0,
"reason": null,
"type": "community",
"relativePosition": 0
},
"post": {
"id": "t3_1rklhpf",
"isNsfw": false,
"isSpoiler": false,
"title": "Why has Deepseek become basically unusable for me?",
"type": "TEXT"
},
"subreddit": {
"id": "t5_a5tk5l",
"isNsfw": false,
"isQuarantined": false,
"name": "DeepSeek"
},
"metaSearch": null,
"profile": null,
"answers": null
},
"events": [
{
"source": "search",
"action": "click",
"noun": "post",
"trigger": "CLICK",
"triggerConfiguration": null
}
]
}
},
"default": {
"__typename": "SearchPDPNavigationBehavior",
"id": "t3_1rklhpf",
"telemetry": {
"__typename": "SearchElementTelemetry",
"trackingContext": {
"__typename": "SearchTelemetryTrackingContext",
"search": {
"isNsfw": false,
"range": null,
"safeSearch": "UNAVAILABLE",
"scope": {
"id": null,
"name": null,
"path": "/",
"type": "GLOBAL"
},
"snippet": null,
"snippetId": null,
"sort": null,
"query": "deepseek",
"queryID": "720e3c25-1254-4e09-bf52-bbd49666c5a7"
},
"actionInfo": {
"paneName": "posts",
"position": 0,
"reason": null,
"type": "post",
"relativePosition": 0
},
"post": {
"id": "t3_1rklhpf",
"isNsfw": false,
"isSpoiler": false,
"title": "Why has Deepseek become basically unusable for me?",
"type": "TEXT"
},
"subreddit": {
"id": "t5_a5tk5l",
"isNsfw": false,
"isQuarantined": false,
"name": "DeepSeek"
},
"metaSearch": null,
"profile": null,
"answers": null
},
"events": [
{
"source": "search",
"action": "click",
"noun": "post",
"trigger": "CLICK",
"triggerConfiguration": null
}
]
}
},
"profile": {
"__typename": "SearchProfileNavigationBehavior",
"id": "t5_gkz2y9",
"name": "u_77ChryslerNewYorker",
"telemetry": {
"__typename": "SearchElementTelemetry",
"trackingContext": {
"__typename": "SearchTelemetryTrackingContext",
"search": {
"isNsfw": false,
"range": null,
"safeSearch": "UNAVAILABLE",
"scope": {
"id": null,
"name": null,
"path": "/",
"type": "GLOBAL"
},
"snippet": null,
"snippetId": null,
"sort": null,
"query": "deepseek",
"queryID": "720e3c25-1254-4e09-bf52-bbd49666c5a7"
},
"actionInfo": {
"paneName": "posts",
"position": 0,
"reason": null,
"type": "profile",
"relativePosition": 0
},
"post": {
"id": "t3_1rklhpf",
"isNsfw": false,
"isSpoiler": false,
"title": "Why has Deepseek become basically unusable for me?",
"type": "TEXT"
},
"subreddit": {
"id": "t5_a5tk5l",
"isNsfw": false,
"isQuarantined": false,
"name": "DeepSeek"
},
"metaSearch": null,
"profile": null,
"answers": null
},
"events": [
{
"source": "search",
"action": "click",
"noun": "post",
"trigger": "CLICK",
"triggerConfiguration": null
}
]
}
},
"thumbnail": {
"__typename": "SearchPDPNavigationBehavior",
"id": "t3_1rklhpf",
"telemetry": {
"__typename": "SearchElementTelemetry",
"trackingContext": {
"__typename": "SearchTelemetryTrackingContext",
"search": {
"isNsfw": false,
"range": null,
"safeSearch": "UNAVAILABLE",
"scope": {
"id": null,
"name": null,
"path": "/",
"type": "GLOBAL"
},
"snippet": null,
"snippetId": null,
"sort": null,
"query": "deepseek",
"queryID": "720e3c25-1254-4e09-bf52-bbd49666c5a7"
},
"actionInfo": {
"paneName": "posts",
"position": 0,
"reason": null,
"type": "thumbnail",
"relativePosition": 0
},
"post": {
"id": "t3_1rklhpf",
"isNsfw": false,
"isSpoiler": false,
"title": "Why has Deepseek become basically unusable for me?",
"type": "TEXT"
},
"subreddit": {
"id": "t5_a5tk5l",
"isNsfw": false,
"isQuarantined": false,
"name": "DeepSeek"
},
"metaSearch": null,
"profile": null,
"answers": null
},
"events": [
{
"source": "search",
"action": "click",
"noun": "post",
"trigger": "CLICK",
"triggerConfiguration": null
}
]
}
}
},
"telemetry": {
"__typename": "SearchElementTelemetry",
"trackingContext": {
"__typename": "SearchTelemetryTrackingContext",
"search": {
"isNsfw": false,
"range": null,
"safeSearch": "UNAVAILABLE",
"scope": {
"id": null,
"name": null,
"path": "/",
"type": "GLOBAL"
},
"snippet": null,
"snippetId": null,
"sort": null,
"query": "deepseek",
"queryID": "720e3c25-1254-4e09-bf52-bbd49666c5a7"
},
"actionInfo": {
"paneName": "posts",
"position": 0,
"reason": null,
"type": null,
"relativePosition": 0
},
"post": {
"id": "t3_1rklhpf",
"isNsfw": false,
"isSpoiler": false,
"title": "Why has Deepseek become basically unusable for me?",
"type": "TEXT"
},
"subreddit": {
"id": "t5_a5tk5l",
"isNsfw": false,
"isQuarantined": false,
"name": "DeepSeek"
},
"metaSearch": null,
"profile": null,
"answers": null
},
"events": [
{
"source": "search",
"action": "view",
"noun": "post",
"trigger": "VIEW",
"triggerConfiguration": null
}
]
}
}
]
}
}
],
"pageInfo": {
"startCursor": "",
"hasNextPage": true,
"hasPreviousPage": false,
"endCursor": "eyJjYW5kaWRhdGVzX3JldHVybmVkIjoie1wic2VjdGlvbl8xX3BpcGVsaW5lXzBfZ2xvYmFsX21vZGlmaWVyc1wiOlwiM1wiLFwi..."
}
},
"top": {
"filterBar": [
{
"__typename": "SearchDropdown",
"presentation": {
"__typename": "SearchFilterOptionListPresentation",
"id": "post_sort",
"title": "排序方式",
"buttonText": "相关性",
"options": [
{
"text": "相关性",
"secondaryText": null,
"isSelected": true
}
]
},
"behaviors": [
{
"__typename": "SearchFilterBehavior",
"id": "relevance",
"filters": [
{
"key": "sort",
"value": "RELEVANCE"
}
],
"pane": "posts",
"isAppliedFiltersRemoved": false,
"isAppliedOptionsRemoved": false,
"query": "deepseek",
"options": [],
"telemetry": {
"__typename": "SearchElementTelemetry",
"trackingContext": {
"__typename": "SearchTelemetryTrackingContext",
"search": {
"isNsfw": false,
"range": null,
"safeSearch": "UNAVAILABLE",
"scope": {
"id": null,
"name": null,
"path": "/",
"type": "GLOBAL"
},
"snippet": null,
"snippetId": null,
"sort": "relevance",
"query": "deepseek",
"queryID": "720e3c25-1254-4e09-bf52-bbd49666c5a7"
},
"actionInfo": {
"paneName": "posts",
"position": null,
"reason": null,
"type": "bottom_sheet",
"relativePosition": null
},
"post": null,
"subreddit": null,
"metaSearch": null,
"profile": null,
"answers": null
},
"events": [
{
"source": "search",
"action": "click",
"noun": "sort",
"trigger": "CLICK",
"triggerConfiguration": null
}
]
}
}
]
}
],
"navigation": {
"__typename": "SearchNavigationList",
"listPresentation": {
"items": [
{
"id": "posts",
"text": "帖子",
"isSelected": true
}
]
},
"behaviors": [
{
"__typename": "SearchNoOpBehavior",
"isNoOpBehavior": true
}
]
},
"filterModal": null
},
"telemetry": {
"__typename": "SearchElementTelemetry",
"trackingContext": {
"__typename": "SearchTelemetryTrackingContext",
"search": {
"isNsfw": false,
"range": null,
"safeSearch": "UNAVAILABLE",
"scope": {
"id": null,
"name": null,
"path": "/",
"type": "GLOBAL"
},
"snippet": null,
"snippetId": null,
"sort": null,
"query": "deepseek",
"queryID": "720e3c25-1254-4e09-bf52-bbd49666c5a7"
},
"actionInfo": {
"paneName": "posts",
"position": null,
"reason": null,
"type": null,
"relativePosition": null
},
"post": null,
"subreddit": null,
"metaSearch": null,
"profile": null,
"answers": null
},
"events": [
{
"source": "search",
"action": "load",
"noun": "feed",
"trigger": "LOAD",
"triggerConfiguration": null
}
]
}
}
}
}
}
}💡 提示:为简化展示,列表类数据样例仅保留 1-2 条记录,实际返回条数以接口响应为准。
