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

# Reddit の検索、投稿、コメント API (REDDIT)

> Reddit の投稿を検索し、投稿1つをコメントの最初のページとともに読み、サブレディットやユーザーの最新投稿を一覧します。

`REDDIT` は公開されている Reddit を読みます。payload で選ぶ4つのモードがあります: 検索(`query`)、コメント付きの投稿1つ(`url`)、サブレディットのフィード(`action: "feed"`)、ユーザーの投稿(`action: "user_posts"`)。

| | |
| - | - |
| `taskType` | `REDDIT` |
| 入力 | `query`、`url`、`action`(`feed`、`user_posts`)のいずれか。`subreddit`、`username`、`commentSort`、`commentMaxDepth`、`limit`、`country` |
| クレジット | タスクあたり1 |
| 国 | 既定値は `US`。 |
| 位置 | 非対応(`422 LOCATION_UNSUPPORTED`)。 |

## 投稿を検索する

```bash theme={"theme":"css-variables"}
curl -X POST https://api.querying.ai/v1/async/task \
  -H "Authorization: Bearer $QUERYING_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "taskType": "REDDIT", "payload": { "query": "running shoes for flat feet", "subreddit": "RunningShoeGeeks" } }'
```

| フィールド | 必須 | 説明 |
| - | - | - |
| `query` | はい | 検索クエリ。`query` がなければ `prompt` を受け付けます。 |
| `subreddit` | いいえ | 1つのサブレディットだけを検索します。`r/` を除いた名前で、英字、数字、アンダースコアの2〜21文字。 |

検索は最大25件の投稿を返します。例:

```json theme={"theme":"css-variables"}
{
  "results": [
    { "postId": "1uzk9m4", "title": "...", "url": "https://www.reddit.com/r/RunningShoeGeeks/comments/1uzk9m4/...", "subreddit": "RunningShoeGeeks", "preview": "..." }
  ]
}
```

`preview` は投稿にテキストがある場合、その冒頭を最大2,000文字まで返します。完了したタスクで `results` が空なら、Reddit で何も見つからなかったことを意味します。

## 投稿とコメントを読む

`query` の代わりに投稿の `url` を送ります。

```bash theme={"theme":"css-variables"}
curl -X POST https://api.querying.ai/v1/async/task \
  -H "Authorization: Bearer $QUERYING_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "taskType": "REDDIT", "payload": { "url": "https://www.reddit.com/r/RunningShoeGeeks/comments/1uer62n/", "commentSort": "top", "commentMaxDepth": 1 } }'
```

| フィールド | 必須 | 説明 |
| - | - | - |
| `url` | はい | reddit.com の投稿アドレス: `https://www.reddit.com/r/{subreddit}/comments/{postId}/...`。それ以外のアドレスは `422 VALIDATION_ERROR` を返します。 |
| `commentSort` | いいえ | `top`、`new`、`controversial`、`old`、`qa` のいずれか。指定しない場合は Reddit 自身の既定の順序になります。 |
| `commentMaxDepth` | いいえ | これより深い返信を除きます。0〜100の整数で、`0` ならトップレベルのコメントのみ。 |

タスクは投稿と、コメントの最初のページ(20〜25件程度)を読みます。例:

```json theme={"theme":"css-variables"}
{
  "post": {
    "postId": "1uer62n", "title": "...", "body": "...", "author": "...", "subreddit": "RunningShoeGeeks",
    "score": 12, "upvoteRatio": 0.9, "commentCount": 48, "createdAt": "2026-06-24T21:51:21.586000+0000",
    "archived": false, "url": "https://www.reddit.com/r/RunningShoeGeeks/comments/1uer62n/..."
  },
  "comments": {
    "availableCount": 24,
    "returnedCount": 24,
    "items": [
      { "commentId": "otlz8m5", "author": "...", "body": "...", "score": 5, "depth": 0, "isSubmitter": false, "createdAt": "...", "url": "https://www.reddit.com/r/..." }
    ]
  }
}
```

| フィールド | 説明 |
| - | - |
| `post.commentCount` | Reddit が報告する投稿のコメント数。Reddit が省略した場合は、読んだページにあるコメント数。`comments` にはそのページだけが入ります。 |
| `post.archived` | 投稿の経過日数から推定します。Reddit は約180日後にコメントをロックします。 |
| `post.author`、`post.body` | Reddit が表示しない場合(削除された投稿者、リンク投稿)は `null`。 |
| `comments.items[].depth` | 返信の深さ。`0` はトップレベルのコメントです。返信には `parentId` が付きます。 |
| `comments.items[].isSubmitter` | 投稿者自身が書いたコメントなら `true`。 |

> [!NOTE]
>
> 読めるのはコメントの最初のページだけです。さらにコメントを展開する `commentLimit` は、セルフサーブプランでは `422 VALIDATION_ERROR` を返します。

## 最新投稿を一覧する

| Payload | 返す内容 |
| - | - |
| `{ "action": "feed", "subreddit": "RunningShoeGeeks" }` | サブレディットの最新投稿。`subreddit` がなければ r/popular。 |
| `{ "action": "user_posts", "username": "example_user" }` | ユーザーが投稿したもの。`username` は英字、数字、アンダースコア、ハイフンの3〜20文字。 |

どちらも検索と同じ形の `results` を、`limit`(既定25)件まで返します。

## 制限とエラー

* `REDDIT` は `markdown`、`rawResponse`、`searchQueries` を無視します。`html` と `analysis` は `422`、`citationAnalysis` は `400` で拒否します。[未対応のフラグ](/ja/engines/response-options.md#未対応のフラグ)を参照してください。
* 不正な `subreddit`、`username`、`url`、`commentSort` は `422 VALIDATION_ERROR` を返します。
* その他のリクエストエラーは[エラー](/ja/concepts/errors.md)に記載しています。

## 関連

* [Webスクレイプ](/ja/engines/web-scrape.md): Reddit 以外のページ
* [非同期タスク](/ja/concepts/async-tasks.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.