> ## Documentation Index
> Fetch the complete documentation index at: https://aisa.one/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Subreddit 帖子

> Subreddit 帖子

获取某个 subreddit 的帖子流。subreddit 名称区分大小写（应使用 `AskReddit`，而非 `askreddit`）。

## 示例

```bash theme={null}
curl "https://api.aisa.one/apis/v1/reddit/subreddit?subreddit=VALUE" \
  -H "Authorization: Bearer YOUR_API_KEY"
```


## OpenAPI

````yaml openapi/zh/reddit.json GET /reddit/subreddit
openapi: 3.0.0
info:
  title: Reddit API
  description: 读取 Reddit 公开数据——搜索帖子、浏览 subreddit 以及获取评论。
  version: 1.0.0
servers:
  - url: https://api.aisa.one/apis/v1
security:
  - bearerAuth: []
paths:
  /reddit/subreddit:
    get:
      tags:
        - Reddit API
      summary: Subreddit 帖子
      description: >-
        获取 subreddit 中的帖子，并提供排序和筛选选项。每个帖子均包含
        title、author、selftext、score、ups、upvote_ratio、num_comments、created_utc、url、permalink、subreddit_subscribers
        和 is_video。支持 sort（best、hot、new、top、rising）、timeframe 筛选、通过 after token
        进行分页，以及用于精简响应的 trim 参数。
      operationId: get_reddit-subreddit
      parameters:
        - name: subreddit
          in: query
          required: true
          description: Subreddit 名称
          schema:
            type: string
        - name: timeframe
          in: query
          required: false
          description: 获取帖子的时间范围。运行时要求提供 `timeframe` 时必须设置 `sort=top`。
          schema:
            type: string
            enum:
              - all
              - day
              - week
              - month
              - year
        - name: sort
          in: query
          required: false
          description: 排序顺序
          schema:
            type: string
            enum:
              - best
              - hot
              - new
              - top
              - rising
        - name: after
          in: query
          required: false
          description: 用于获取更多帖子的 after。请从上一次响应中获取 'after'。
          schema:
            type: string
          example: t3_1234567890
        - name: trim
          in: query
          required: false
          description: 设为 true 以返回精简版响应
          schema:
            type: boolean
          example: 'false'
      responses:
        '200':
          description: 成功响应
          content:
            application/json:
              example:
                posts:
                  - id: 1lfbo7u
                    author: Vetro_Nodulare2
                    author_fullname: t2_16syu27ar1
                    subreddit: AskReddit
                    title: What is a thing you love that lots of people hate?
                    downs: 0
                    name: t3_1lfbo7u
                    upvote_ratio: 0.9
                    ups: 45
                    total_awards_received: 0
                    score: 45
                    created: 1750341959
                    num_comments: 349
                    url: >-
                      https://www.reddit.com/r/AskReddit/comments/1lfbo7u/what_is_a_thing_you_love_that_lots_of_people_hate/
                    subreddit_subscribers: 56146328
                    is_video: false
                    created_utc: 1750341959
                after: t3_1lfogps
              schema:
                $ref: '#/components/schemas/RedditPostsResponse'
        '400':
          description: 错误请求，例如提供 `timeframe`，但排序方式不是 `top`。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AIsaSocialError'
components:
  schemas:
    RedditPostsResponse:
      type: object
      properties:
        success:
          type: boolean
        credits_remaining:
          type: integer
        posts:
          type: array
          items:
            $ref: '#/components/schemas/RedditPost'
        after:
          type: string
          nullable: true
        cursor:
          type: string
          nullable: true
      additionalProperties: true
    AIsaSocialError:
      type: object
      properties:
        success:
          type: boolean
        credits_remaining:
          type: integer
        error:
          type: string
        errorStatus:
          type: integer
        message:
          type: string
      additionalProperties: true
    RedditPost:
      type: object
      additionalProperties: true
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: AIsa API 密钥。前往 https://aisa.one 获取

````