关键词搜索
通过关键词搜索Reddit帖子,可选延续令牌。用于发现与主题相关的讨论或继续浏览其他搜索结果页面。
参数
| 参数 | 必填 | 类型 | 说明 | 示例 | 可选值 |
|---|---|---|---|---|---|
keyword |
必填 | string | 搜索查询关键词。 | 咖啡 |
— |
after |
可选 | string | 用于检索下一组结果的分页令牌。 | — | — |
代码示例
curl -G "https://api.mofa-ai.com/v1/reddit/search_v1" \
-H "Authorization: Bearer $MOFA_API_KEY" \
--data-urlencode 'keyword=咖啡'
import os
import requests
resp = requests.get(
"https://api.mofa-ai.com/v1/reddit/search_v1",
headers={"Authorization": f"Bearer {os.environ['MOFA_API_KEY']}"},
params={
"keyword": "咖啡",
},
timeout=60,
)
body = resp.json()
if body["success"]:
print(body["cost_usd"], body["data"])
else:
print(body["error"], body["message"])
const url = new URL("https://api.mofa-ai.com/v1/reddit/search_v1");
url.search = new URLSearchParams({
keyword: "咖啡",
});
const resp = await fetch(url, {
headers: { Authorization: `Bearer ${process.env.MOFA_API_KEY}` },
});
const body = await resp.json();
if (body.success) console.log(body.cost_usd, body.data);
else console.error(body.error, body.message);
在线试用
登录后可以在这里直接调用此接口,按价格从余额扣费,失败不收费。新账户赠送 $0.50 试用额度。
响应示例
采集于 2026-11-08,耗时 2559 ms · 请求参数 {"keyword": "咖啡"}
JSON
{
"success": true,
"code": 0,
"message": "success",
"request_id": "req_5f1c2a9be04d7c3a81f6e2d0",
"endpoint": "reddit.search_v1",
"cost_usd": 0.02,
"data": {
"code": 0,
"data": {
"search": {
"dynamic": {
"components": {
"top": {
"filterBar": [
{
"behaviors": [
{
"id": "relevance",
"pane": "posts",
"query": "咖啡",
"filters": [
{
"key": "sort",
"value": "RELEVANCE"
}
],
"options": [],
"telemetry": {
"events": [
{
"noun": "…",
"action": "…",
"source": "…",
"trigger": "…",
"triggerConfiguration": "…"
}
],
"__typename": "SearchElementTelemetry",
"trackingContext": {
"post": null,
"search": {
"sort": "…",
"query": "…",
"range": "…",
"scope": "…",
"isNsfw": "…",
"queryID": "…",
"snippet": "…",
"snippetId": "…",
"safeSearch": "…"
},
"answers": null,
"profile": null,
"subreddit": null,
"__typename": "SearchTelemetryTrackingContext",
"actionInfo": {
"type": "…",
"reason": "…",
"paneName": "…",
"position": "…",
"relativePosition": "…"
},
"metaSearch": null
}
},
"__typename": "SearchFilterBehavior",
"isAppliedFiltersRemoved": false,
"isAppliedOptionsRemoved": false
},
"… +4"
],
"__typename": "SearchDropdown",
"presentation": {
"id": "post_sort",
"title": "Sort by",
"options": [
{
"text": "Relevance",
"isSelected": true,
"secondaryText": null
},
"… +4"
],
"__typename": "SearchFilterOptionListPresentation",
"buttonText": "Relevance"
}
},
"… +1"
],
"navigation": {
"behaviors": [
{
"id": "all",
"pane": "all",
"query": "咖啡",
"filters": [
{
"key": "safe_search",
"value": "unset"
}
],
"options": [
{
"key": "mode",
"value": "search"
}
],
"telemetry": {
"events": [
{
"noun": "tab",
"action": "click",
"source": "search",
"trigger": "CLICK",
"triggerConfiguration": null
}
],
"__typename": "SearchElementTelemetry",
"trackingContext": {
"post": null,
"search": {
"sort": null,
"query": "咖啡",
"range": null,
"scope": {
"id": "…",
"name": "…",
"path": "…",
"type": "…"
},
"isNsfw": false,
"queryID": "694825bb-bcca-4be3-9a76-7e6c5b67b674",
"snippet": null,
"snippetId": null,
"safeSearch": "UNAVAILABLE"
},
"answers": null,
"profile": null,
"subreddit": null,
"__typename": "SearchTelemetryTrackingContext",
"actionInfo": {
"type": "all",
"reason": null,
"paneName": "posts",
"position": null,
"relativePosition": null
},
"metaSearch": null
}
},
"__typename": "SearchFilterBehavior",
"isAppliedFiltersRemoved": true,
"isAppliedOptionsRemoved": false
},
"… +5"
],
"__typename": "SearchNavigationList",
"listPresentation": {
"items": [
{
"id": "all",
"text": "All",
"isSelected": false
},
"… +5"
]
}
},
"filterModal": null
},
"main": {
"edges": [
{
"node": {
"id": "section_2_pipeline_5_nsfw_banner",
"behaviors": {
"cta": {
"telemetry": {
"events": [
"…"
],
"__typename": "SearchElementTelemetry",
"trackingContext": {
"post": "…",
"search": "…",
"answers": "…",
"profile": "…",
"subreddit": "…",
"__typename": "…",
…
示例较长,此处截断显示。