# Reddit 全站热帖 API (reddit.trending_posts)

- Canonical page: https://everyinfra.com/reddit-api/trending_posts
- Endpoint: POST /api/v1/social with {"platform": "reddit", "action": "trending_posts", "params": {...}}
- Price: $0.000556 per call ($0.56 per 1,000 requests); failed and empty results are not charged
- Returns: list, one page of up to 25 per call; the number of rows varies from page to page and a short page is not the end (limit is ignored; pass the top-level next_page_token from the response as page_token for the next page; no next_page_token means the end)
- Pagination: pass next_page_token back as page_token for the next page, other params unchanged; one call per page, tokens last 24 hours
- Mode: sync; add "mode": "async" for slow tasks

Reddit 全站热帖没有必填参数，每次返回一页热帖，每页最多 25 条，条数不固定，短页不代表到底。每行带 `title`、`text`、`author_username`、`community`、`like_count` 和 `comment_count`，链接帖有 `external_link`，有图的帖子有 `image_urls`。它回答「Reddit 全站现在哪些帖子最热」，适合做热点发现和选题。

翻页：`page_token` 不传就从第一页开始，要更多就用响应顶层的 `next_page_token`，没有它才是到底；`limit` 填多少都不改变每页条数。读到感兴趣的帖子，把行里的 `url` 交给内容详情读分类标签和缩略图，交给评论那一页读讨论。

## Health

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

## Parameters

| name | type | required | default | description |
|---|---|---|---|---|
| page_token | not declared | no | not declared | trending_posts 的翻页令牌：把上一页响应里的 next_page_token 原样传回拿下一页（每页约 25 帖）；不传从第一页开始。 |

## Response fields (items in `results`)

| field | meaning |
|---|---|
| next_page_token | platform-native meaning |
| id | 该记录在原平台上的唯一标识。仅在同一平台内唯一，跨平台可能重复。 |
| url | 该记录在原平台上的可访问链接。 |
| title | 标题。平台无标题概念时（如纯文本帖）为 null。 |
| text | 正文内容，已去除 HTML 标签，全文返回、不截断（个别平台的列表结果本身只有摘要，以该平台的字段说明为准）。 |
| author_username | 作者用户名（@handle），通常可用于拼 URL。 |
| community | 所属 subreddit 名称（不含 r/ 前缀）。 |
| like_count | 点赞数。null 表示该平台或该接口不公开此数据，不等于 0。 |
| comment_count | 评论数。null 表示不公开，不等于 0。 |
| posted_at | 发布时间，ISO 8601 格式、UTC 时区（如 2026-08-07T12:34:56+00:00）。平台只给非标准字符串时原样透传，解析前建议做容错。null 表示平台未公开。 |
| domain | 帖子链接的域名（文字帖为 self.版块名 或 reddit.com）。 |
| external_link | 链接帖指向的站外地址。 |
| image_urls | 帖子里的图片地址。 |
| 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": "trending_posts",
  "params": {}
}'
```

```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": "trending_posts",
        "params": {},
    },
    timeout=120,
)
print(response.status_code)
print(response.json())
```

## Response example

No real sample for these example parameters yet: structure only, every value is a placeholder (…).

```text
{
  "id": "req_…",
  "platform": "reddit",
  "action": "trending_posts",
  "results": [
    {
      "next_page_token": …,
      "id": …,
      "url": …,
      "title": …,
      "text": …,
      "author_username": …,
      "community": …,
      "like_count": …,
      "comment_count": …,
      "posted_at": …,
      "domain": …,
      "external_link": …,
      "image_urls": …,
      "platform": …
    }
  ],
  "next_page_token": …,
  "pagination": { … },
  "count": …,
  "billing": {
    "charged": …,
    "charged_usd": …,
    "balance_after_usd": …,
    …
  },
  "quota": { … }
}
```

## FAQ

### `limit` 能控制每页条数吗？

不能。`limit` 会被接收，但不起作用，每页最多 25 条，实际条数不固定。想多读就继续翻页，想少读就少翻几页。

### 一页只有十几条，是不是已经到底了？

不是。短页不代表到底，只有响应里没有 `next_page_token` 才说明读完。程序里判断何时停止，应当看这个字段，不要看条数。

### 热帖列表怎么接单帖详情和评论？

每行的 `url` 就是帖子链接。先用 `comment_count` 筛出讨论多的帖子，再把 `url` 传给评论那一页读讨论；要分类标签和缩略图，传给内容详情。`comment_count` 为 null 表示不公开，不是没有评论。

## 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
