Reddit 帖子搜索
搜索与商品、品牌或问题相关的 Reddit 帖子,每条带类型(提问、吐槽、经验分享等)、情感倾向和英文摘要(含回复里给出的解决办法)。
API 数据样例
直接查看该接口实际使用的请求体和完整响应结构。
{
"keyword": "air fryer",
"postTypes": [
"complaint"
]
}{
"request_id": "9435d779-cf2c-5ccd-9dc5-29b0e31fdcc4",
"data": [
{
"item_index": 1,
"item_total": 56,
"reddit_id": "t3_1vzpell",
"subreddit": "r/mildlyinfuriating",
"author": "SpecificHyena1933",
"published_time": "2026-08-27",
"post_type": "complaint",
"main_post_sentiment": "negative",
"reply_sentiment_ratio": {
"Positive": 0.15,
"Neutral": 0.62,
"Negative": 0.23
},
"product": "air fryer, replacement bins",
"summary": "A daily air fryer user complains that after two years of continuous use and cleaning, the replacement bins cost $12 more than buying a new unit, making them prohibitively expensive compared to the device itself ($150). Users discuss whether this is planned obsolescence or a logistics issue where ind",
"like_count": 0,
"reply_count": 89,
"url": ""
},
{
"item_index": 2,
"item_total": 56,
"reddit_id": "t3_1wfyvlh",
"subreddit": "r/HousingUK",
"author": "SoftAndWet06",
"published_time": "2026-09-14",
"post_type": "complaint",
"main_post_sentiment": "negative",
"reply_sentiment_ratio": {
"Positive": 0,
"Neutral": 0.6,
"Negative": 0.4
},
"product": "air fryer, slow cooker, toaster, kettle, pots, pans, silverware, utensils",
"summary": "A university student in England returning after a summer break found that management cleared out all their shared kitchen belongings, including an air fryer, slow cooker, toaster, kettle, pots, pans, and utensils, claiming they were deep cleaning. The tenant was not notified via email despite notice",
"like_count": 8,
"reply_count": 13,
"url": ""
}
]
}可用状态:已开放
该接口已进入 v1 网关、OpenAPI 和订阅权限目录,每次调用消耗 1 个计费单位,查不到数据(
RESULT_NOT_FOUND)也照常计费。
POST /v1/social/reddit/posts/search
下方请求和响应字段已与当前公开契约核对。
MCP 调用
| 项目 | 内容 |
|---|---|
| MCP Code | social_reddit_posts_search |
快速调用
先创建 API 密钥,再将密钥写入服务端环境变量:
export ECOMMERCE_DATA_API_KEY="your_api_key"curl --request POST \
--url https://ecommercedataapi.com/v1/social/reddit/posts/search \
--header "Content-Type: application/json" \
--header "X-API-Key: ${ECOMMERCE_DATA_API_KEY}" \
--data '{
"keyword": "air fryer",
"postTypes": [
"complaint"
]
}'使用 AI CLI 接入
复制给 AI CLI
粘贴到 Codex、Claude Code、Gemini CLI 或其他编程智能体中直接完成接入。
请直接在当前代码库中接入 Ecommerce Data API 的「Reddit 帖子搜索」接口,不要只给示例代码。
接口文档:https://ecommercedataapi.com/zh/docs/social/reddit/post-search
请求接口:POST https://ecommercedataapi.com/v1/social/reddit/posts/search
API 密钥环境变量:ECOMMERCE_DATA_API_KEY
请求示例:
{
"keyword": "air fryer",
"postTypes": [
"complaint"
]
}
请按以下要求执行:
1. 先阅读接口文档,并检查当前项目使用的语言、框架、HTTP 客户端、目录结构和环境变量约定。
2. 优先复用项目现有的 API 客户端和错误处理方式;如果没有,再创建最小可复用的 Ecommerce Data API 客户端与该接口调用封装。
3. 从服务端环境变量 ECOMMERCE_DATA_API_KEY 读取密钥,发送 Content-Type: application/json 和 X-API-Key 请求头。绝不能把真实密钥写入源码、前端代码、日志、测试快照或 Git。
4. 如果环境变量不存在,提示我自行设置 ECOMMERCE_DATA_API_KEY;不要索取、输出或猜测真实密钥,并继续完成不依赖真实请求的代码与测试。
5. 根据接口文档实现请求与响应类型,处理非 2xx 响应、request_id、error.code、error.message 和 429 限流。
6. 添加一个符合当前项目习惯的最小调用示例或测试。如果密钥已配置且当前环境允许外部请求,再执行一次最小真实调用;否则使用 mock 或静态验证。
7. 运行相关格式化、类型检查和测试,最后汇报修改文件、调用方法、验证结果以及仍需我配置的环境变量。还没有 API 密钥?创建 API 密钥
在 Postman 中打开当前请求
下载当前接口的预配置 Collection,再通过 Postman Import 导入。
导入后在 Collection Variables 中填写 apiKey。创建 API 密钥
Node.js 示例
const response = await fetch(
'https://ecommercedataapi.com/v1/social/reddit/posts/search',
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-Key': process.env.ECOMMERCE_DATA_API_KEY,
},
body: JSON.stringify({
keyword: 'air fryer',
postTypes: ['complaint'],
}),
}
);
const result = await response.json();
if (!response.ok) {
throw new Error(`${result.error?.code}: ${result.error?.message}`);
}
console.log(result.data);Python 示例
import os
import requests
response = requests.post(
"https://ecommercedataapi.com/v1/social/reddit/posts/search",
headers={
"Content-Type": "application/json",
"X-API-Key": os.environ["ECOMMERCE_DATA_API_KEY"],
},
json={
"keyword": "air fryer",
"postTypes": [
"complaint",
],
},
timeout=30,
)
response.raise_for_status()
print(response.json()["data"])请求参数
请求体直接发送下表字段,不要再包裹额外对象;未定义字段会被拒绝。
| 字段 | 类型 | 必填 | 说明 | 示例 |
|---|---|---|---|---|
keyword | 字符串 | 是 | 搜索内容:商品、品牌或问题,中英文都可以。 | air fryer |
postTypes | 数组 | 否 | 只看这些类型:question 求助、purchase_advice 购买咨询、complaint 吐槽、experience 经验分享、discussion 讨论、innovation 创意、other 其他。 | ["complaint"] |
sentiment | 字符串 | 否 | 只看该主帖情感倾向:positive 正面、neutral 中性、negative 负面。 | negative |
page | 整数 | 否 | 页码,每页 20 条。 | 1 |
返回结构
| 字段 | 类型 | 说明 |
|---|---|---|
request_id | 字符串 | 本次请求的唯一标识。 |
data | 数组 | 接口业务数据。 |
下表字段位于 data 内。数组接口描述的是单个数组元素,分页接口描述的是 items[] 中的单条记录。
返回字段
| 字段 | 类型 | 说明 | 示例 |
|---|---|---|---|
item_index | 整数 | 当前条目的序号 | 1 |
item_total | 整数 | 相关帖子总数 | 56 |
reddit_id | 字符串 | 帖子 ID(t3_ 前缀),可作为 postId 传给 Reddit 帖子详情或 Reddit 帖子回复接口 | t3_1vzpell |
subreddit | 字符串 | 发帖所在的子版块 | r/mildlyinfuriating |
author | 字符串 | 发帖人用户名 | SpecificHyena1933 |
published_time | 字符串 | 帖子发布时间 | 2026-08-27 |
post_type | 字符串 | 帖子类型:problem、inquiry、complaint、experience_share、discussion、innovation 或 other | complaint |
main_post_sentiment | 字符串 | 主帖情感倾向:positive、neutral 或 negative | negative |
reply_sentiment_ratio | 对象 | 回复的情感倾向占比;帖子没有回复时为 null | - |
product | 字符串 | 帖子中提到的品牌、产品或关键部件 | air fryer, replacement bins |
summary | 字符串 | 帖子核心内容摘要(英文),包含回复中给出的解决方案 | A daily air fryer user complains that after two years of continuous use and cleaning, the replacement bins cost $12 more |
like_count | 整数 | 点赞数 | 0 |
reply_count | 整数 | 回复数 | 89 |
url | 字符串 | 原帖链接 | - |
返回示例
{
"request_id": "9435d779-cf2c-5ccd-9dc5-29b0e31fdcc4",
"data": [
{
"item_index": 1,
"item_total": 56,
"reddit_id": "t3_1vzpell",
"subreddit": "r/mildlyinfuriating",
"author": "SpecificHyena1933",
"published_time": "2026-08-27",
"post_type": "complaint",
"main_post_sentiment": "negative",
"reply_sentiment_ratio": {
"Positive": 0.15,
"Neutral": 0.62,
"Negative": 0.23
},
"product": "air fryer, replacement bins",
"summary": "A daily air fryer user complains that after two years of continuous use and cleaning, the replacement bins cost $12 more than buying a new unit, making them prohibitively expensive compared to the device itself ($150). Users discuss whether this is planned obsolescence or a logistics issue where ind",
"like_count": 0,
"reply_count": 89,
"url": ""
},
{
"item_index": 2,
"item_total": 56,
"reddit_id": "t3_1wfyvlh",
"subreddit": "r/HousingUK",
"author": "SoftAndWet06",
"published_time": "2026-09-14",
"post_type": "complaint",
"main_post_sentiment": "negative",
"reply_sentiment_ratio": {
"Positive": 0,
"Neutral": 0.6,
"Negative": 0.4
},
"product": "air fryer, slow cooker, toaster, kettle, pots, pans, silverware, utensils",
"summary": "A university student in England returning after a summer break found that management cleared out all their shared kitchen belongings, including an air fryer, slow cooker, toaster, kettle, pots, pans, and utensils, claiming they were deep cleaning. The tenant was not notified via email despite notice",
"like_count": 8,
"reply_count": 13,
"url": ""
}
]
}错误响应、请求追踪和限流头说明见错误与限流。