Reddit Scraper API 数据集概述
基本信息
- 数据集名称: Reddit Scraper API
- 类别: Social
- 提供者: elis-lab
- 订阅计划:
- BASIC: $0.00 / 月
- PRO: $12.00 / 月
- ULTRA: $35.00 / 月
- MEGA: $99.00 / 月
功能描述
- 无需Reddit API密钥或OAuth认证即可访问Reddit数据。
- 通过抓取Reddit的公共JSON端点提供干净、结构化的数据。
- 支持分页(使用
after/before游标)。
- 提供一致的JSON响应,字段名经过清理。
- 处理帖子、评论、用户和子版块元数据。
- 部署在Vercel上以实现低延迟。
端点列表
帖子 (Posts)
GET /posts/subreddit/{subreddit}: 从任何公共子版块获取帖子(支持排序和分页)。
GET /posts/search: 通过关键词搜索Reddit帖子。
GET /posts/{subreddit}/{postId}: 获取帖子及其评论。
用户 (Users)
GET /users/{username}: 获取用户的公开资料。
GET /users/{username}/posts: 获取用户提交的帖子。
GET /users/{username}/comments: 获取用户发表的评论。
子版块 (Subreddits)
GET /subreddits/{subreddit}: 获取子版块元数据。
GET /subreddits/search: 通过关键词搜索子版块。
GET /subreddits/popular: 获取最受欢迎的子版块。
参数参考
子版块帖子 (GET /posts/subreddit/{subreddit})
| 参数 |
类型 |
默认值 |
描述 |
subreddit (路径) |
string |
— |
子版块名称(不带r/,例如programming) |
sort |
string |
hot |
排序方式:hot、new、top、rising、controversial |
t |
string |
all |
时间周期(用于top/controversial):hour、day、week、month、year、all |
limit |
integer |
25 |
每页帖子数(1–100) |
after |
string |
— |
分页游标(来自上一响应) |
before |
string |
— |
分页游标(用于上一页) |
搜索帖子 (GET /posts/search)
| 参数 |
类型 |
默认值 |
描述 |
q |
string |
必填 |
搜索查询 |
sort |
string |
relevance |
排序方式:relevance、hot、top、new、comments |
t |
string |
all |
时间周期:hour、day、week、month、year、all |
limit |
integer |
25 |
每页结果数(1–100) |
subreddit |
string |
— |
将搜索限制在此子版块 |
after |
string |
— |
分页游标 |
帖子与评论 (GET /posts/{subreddit}/{postId})
| 参数 |
类型 |
默认值 |
描述 |
subreddit (路径) |
string |
— |
子版块名称 |
postId (路径) |
string |
— |
帖子ID(来自post.id,例如1s9jkzi) |
sort |
string |
best |
评论排序:best、top、new、controversial、old、qa |
limit |
integer |
100 |
最大评论数(1–500) |
depth |
integer |
5 |
评论嵌套深度(1–10) |
用户资料 (GET /users/{username})
| 参数 |
类型 |
描述 |
username (路径) |
string |
Reddit用户名 |
用户帖子/评论 (GET /users/{username}/posts 或 /comments)
| 参数 |
类型 |
默认值 |
描述 |
username (路径) |
string |
— |
Reddit用户名 |
sort |
string |
new |
排序方式:hot、new、top |
t |
string |
all |
时间周期(用于top):hour、day、week、month、year、all |
limit |
integer |
25 |
每页项目数(1–100) |
after |
string |
— |
分页游标 |
子版块 (GET /subreddits/{subreddit}、/search、/popular)
| 参数 |
类型 |
默认值 |
描述 |
subreddit (路径) |
string |
— |
子版块名称(用于信息端点) |
q |
string |
必填 |
搜索查询(用于搜索端点) |
limit |
integer |
25 |
每页结果数(1–100) |
after |
string |
— |
分页游标 |
响应模式
帖子对象
json
{
"id": "1s9jkzi",
"name": "t3_1s9jkzi",
"title": "Announcement: Temporary LLM Content Ban",
"author": "ChemicalRascal",
"authorId": "t2_4ta76",
"subreddit": "programming",
"subredditId": "t5_2fwo",
"score": 2546,
"upvoteRatio": 0.95,
"numComments": 273,
"url": "https://www.reddit.com/r/programming/comments/1s9jkzi/",
"permalink": "https://www.reddit.com/r/programming/comments/1s9jkzi/announcement_temporary_llm_content_ban/",
"thumbnail": null,
"preview": null,
"isSelf": true,
"selftext": "Hey folks, after a lot of discussion...",
"domain": "self.programming",
"flair": null,
"isNsfw": false,
"isPinned": false,
"isLocked": true,
"isSpoiler": false,
"createdAt": "2026-03-30T01:28:20.000Z"
}
评论对象
json
{
"id": "odopfy7",
"name": "t1_odopfy7",
"author": "terablast",
"body": "looks at calendar
hm",
"score": 1043,
"parentId": "t3_1s9jkzi",
"linkId": "t3_1s9jkzi",
"permalink": "https://www.reddit.com/r/programming/comments/1s9jkzi/_/odopfy7/",
"depth": 0,
"isSubmitter": false,
"stickied": false,
"distinguished": null,
"createdAt": "2026-03-30T02:12:25.000Z",
"replies": []
}
分页对象
所有列表响应都包含一个pagination对象:
json
{
"pagination": {
"after": "t3_1qoxwdt",
"before": null,
"count": 25
}
}
分页指南
- Reddit使用基于游标的分页。每个响应包含
pagination.after和pagination.before游标。
- 要获取下一页,请在下一个请求中传递
?after=t3_1qoxwdt。
- 持续分页直到
pagination.after为null,表示已到达末尾。
错误代码
| 状态码 |
含义 |
200 |
成功 |
404 |
未找到子版块、帖子或用户 |
422 |
验证错误 — 检查errors数组获取详情 |
429 |
达到Reddit速率限制 — 几秒后重试 |
502 |
Reddit API不可用或返回错误 |
验证错误示例
json
{
"status": 422,
"message": "Validation errors",
"errors": [
{
"field": "sort",
"message": "sort must be one of: relevance, hot, top, new, comments",
"value": "random"
}
]
}
使用提示
- 分页: Reddit限制每个子版块列表约1000个帖子。使用
sort=new按时间顺序访问最近的帖子。
- 帖子ID:
postId路径参数是短字母数字ID(例如1s9jkzi),而不是全名(t3_1s9jkzi)。
- 评论: 设置
depth=1仅获取顶级评论。设置limit=500获取最大评论数。
- 速率限制: Reddit的公共API允许约60次请求/分钟。此API自动缓存和重试。
- NSFW内容: 可访问NSFW子版块,但帖子返回时带有
isNsfw: true。
- 已删除用户: 某些帖子/评论可能带有
author: "[deleted]" — 这是Reddit表示账户已删除的方式。