# Reddit 评论 API (reddit.comments)

- Canonical page: https://everyinfra.com/reddit-api/comments
- Endpoint: POST https://api.everyinfra.com/api/v1/social with {"platform": "reddit", "action": "comments", "params": {...}}
- Price: $0.000792 per call ($0.79 per 1,000 requests); failed calls and empty results are not charged
- Returns: list, default 10, max 100 per call
- Mode: sync; add "mode": "async" for slow tasks

Reddit 评论按具体帖子的 `url` 返回该帖下的评论，默认 10 条，单次最多 100 条。每行带评论正文 `text`、作者 `author_username`、点赞数 `like_count`、所属板块 `community`、评论自己的链接 `url` 和发布时间 `posted_at`。它回答「这个帖子下的人是怎么讨论的」，适合做话题舆情和产品反馈的抽样阅读。评论链接 `url` 可以直接回到原平台核对。

这是按帖取评论，不是全站评论搜索，也不接受帖子时间窗。帖子本身的标题、分类标签和图片不在这一页，要读单帖信息请用内容详情那一页，它返回单个对象。

## Health

- Live health (24h percent, hourly and daily trends): https://api.everyinfra.com/api/v1/social/availability?platform=reddit&action=comments

## Parameters

| name | type | required | default | description |
|---|---|---|---|---|
| url | not declared | yes | not declared | 具体 Reddit 帖子 URL，返回该帖评论；不是全站评论搜索，不接受帖子时间窗。 |
| limit | integer (1–100) | no | 10 | 这次调用最多返回的条数，整数，1–100；不传按默认值，实际返回可能少于这个数。超过上限会在扣费前返回 422。 |

## Response fields (items in `results`)

| field | meaning |
|---|---|
| id | 该记录在原平台上的唯一标识。仅在同一平台内唯一，跨平台可能重复。 |
| text | 正文内容，已去除 HTML 标签，全文返回、不截断（个别平台的列表结果本身只有摘要，以该平台的字段说明为准）。 |
| author_username | 作者用户名（@handle），通常可用于拼 URL。 |
| like_count | 点赞数。null 表示该平台或该接口不公开此数据，不等于 0。 |
| community | 所属 subreddit 名称（不含 r/ 前缀）。 |
| url | 该记录在原平台上的可访问链接。 |
| posted_at | 发布时间，ISO 8601 格式、UTC 时区（如 2026-08-07T12:34:56+00:00）。平台只给非标准字符串时原样透传，解析前建议做容错。null 表示平台未公开。 |
| platform | 数据来源平台标识，与请求里的 platform 一致（如 xiaohongshu、tiktok）。 |

## Example

```bash
curl -X POST 'https://api.everyinfra.com/api/v1/social' \
  -H "Authorization: Bearer $EVERYINFRA_API_KEY" \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "platform": "reddit",
  "action": "comments",
  "params": {
    "url": "https://www.reddit.com/r/AskUS/comments/1uzedcq/is_coffee_really_a_daily_ritual_for_most_americans/"
  }
}'
```

```python
import os
import requests

response = requests.post(
    "https://api.everyinfra.com/api/v1/social",
    headers={"Authorization": f"Bearer {os.environ['EVERYINFRA_API_KEY']}"},
    json={
        "platform": "reddit",
        "action": "comments",
        "params": {
            "url": "https://www.reddit.com/r/AskUS/comments/1uzedcq/is_coffee_really_a_daily_ritual_for_most_americans/",
        },
    },
    timeout=120,
)
print(response.status_code)
print(response.json())
```

## Response example

Real response to the example request above, captured 2026-09-26T08:56:04Z. `results` and `count` are real with personal information (names, handles, avatars, profile links, contact details) removed; the list keeps the first 2 of 10. `id`, `billing` and `quota` differ on every call, so only their shape is shown.

```text
{
  "id": "req_…",
  "platform": "reddit",
  "action": "comments",
  "results": [
    {
      "id": "oy6sr9j",
      "text": "More like hourly. It's absurd how normally being addicted to coffee/caffeine is treated. It is by far the most destructive (absolutely, not relatively) addiction.",
      "author_username": "•••",
      "like_count": 0,
      "url": "https://www.reddit.com/r/AskUS/comments/1uzedcq/is_coffee_really_a_daily_ritual_for_most_americans/oy6sr9j/",
      "posted_at": "2026-07-17T22:56:55+00:00",
      "platform": "reddit"
    },
    {
      "id": "oy7xkkr",
      "text": "Caffeine can be a problem when it comes to sleep but more and more coffee is linked to having health benefits.",
      "author_username": "•••",
      "like_count": 0,
      "url": "https://www.reddit.com/r/AskUS/comments/1uzedcq/is_coffee_really_a_daily_ritual_for_most_americans/oy7xkkr/",
      "posted_at": "2026-07-18T02:53:08+00:00",
      "platform": "reddit"
    }
  ],
  "count": 10,
  "billing": {
    "charged": …,
    "charged_usd": …,
    "balance_after_usd": …,
    …
  },
  "quota": { … }
}
```

## FAQ

### 能按关键词搜全站的评论吗？

不能。这一页只认 `url` 指定的那一个帖子，参数里只有这一个链接，没有关键词可填，也不能按时间筛帖子。要读某个话题下的评论，得先找到相关帖子的链接，再逐帖来读。

### 评论属于哪个板块怎么看？

看 `community`，它是 subreddit 名称，不带 r/ 前缀。用示例里的帖子读，板块就是 AskUS。同一个帖子下各行的 `community` 一般相同，跨帖汇总评论时才需要用它分组。

### 评论正文会被截断吗，点赞数为 null 怎么办？

正文不会截断，`text` 已去除 HTML 标签、全文返回。`like_count` 为 null 说明平台没有把这个数发出来，别当成零个赞，汇总前先剔除这些行。`posted_at` 是 ISO 8601、UTC 时区，平台只给非标准字符串时原样透传，解析前最好做容错。

## Also

- Capability catalog (no key): https://api.everyinfra.com/api/v1/social/catalog?platform=reddit
- OpenAPI: https://everyinfra.com/openapi.json · Agents guide: https://everyinfra.com/agents.md
