RedditComments by linkAPI
APIの稼働状況
- 24時間の稼働状況
- 正常
- 良好/正常
- 利用可能
過去24時間
過去30日間
comment_urlsに指定した、それぞれ1件のコメントへのリンク(commentsが返すコメントのurlなど)から、最大20件のRedditのコメントを一度に取得します。コメントのリンクが手元にあり、スレッドを再びページ送りせずに現在のテキストとスコアを知りたい場合や、まだ存在するかどうかを確認したい場合に使います。読み取れたコメントごとに1行が返り、フィールドはcommentsの行と同じで、それに加えて、そのコメントが属する投稿のpost_titleとpost_url、および渡した項目であるinputが含まれます。投稿への返信もネストした返信も使用できます。コメントIDだけでは不十分です。課金はコメントごとではなく、リクエストごとです。存在しないコメントは行が作られず、missedリストもないため、inputで行を照合してください。1件も読み取れなかったリクエストは課金されません。無効な配列は、課金前に422で拒否されます。
POST https://api.everyinfra.com/api/v1/socialを送信し、platformにreddit、actionにcomments_lookupを指定します。 料金は1,000リクエストあたり$0.79(1回あたり$0.000792)です。失敗した呼び出しと空の結果には課金されません。 同期処理です。時間のかかるジョブでは、ボディに"mode": "async"を追加し、job_idを取得してポーリングしてください。
AIプロンプト
#EveryInfraのReddit Comments by linkエンドポイント(reddit/comments_lookup)を使ったデータ収集スクリプトの作成を手伝ってください。
エンドポイントの仕組み:
- リクエスト:ヘッダーにAuthorization: Bearer <API key>を指定して、https://api.everyinfra.com/api/v1/socialにPOSTします。APIキーは環境変数EVERYINFRA_API_KEYから読み込み、ハードコードしないでください。
- リクエストボディでplatformにreddit、actionにcomments_lookupを指定し、パラメータはparamsの中に入れます。
- 必須パラメータ:
- comment_urls: Reddit comment links for comments_lookup, as an array of up to 20 entries; a comma-separated string is not accepted.
- 任意パラメータ:
- limit: この呼び出しで返す最大行数で、1以上の整数で指定します。省略するとデフォルト値が適用されます。また、返される行数がこれより少なくなる場合があります。
- レコードのリストを返します。各レコードの主なフィールド: id、text、author_username、like_count、community、url、posted_at、post_title(コメントが付けられた投稿のタイトル(user_comments、comment…)、post_url(Link to the post the comment was left o…)、input(The entry that this row answers, return…).
- リクエストボディの例:
{
"platform": "reddit",
"action": "comments_lookup",
"params": {
"comment_urls": [
"https://www.reddit.com/r/pics/comments/1xwxo1e/comment/19sogasefdc5g/"
]
}
}
- 料金:1,000リクエストあたり$0.79。失敗時および結果が空の場合は課金されません。
- 対象が数十〜数百件ある場合は、ボディに"mode": "async"を追加します。すぐにjob_idが返されるので、GET https://api.everyinfra.com/api/v1/jobs/{job_id}をポーリングして結果を取得します。
- 422の場合は、エラーに含まれる推奨パラメータ名と指定可能な値を使ってリクエストを修正します。429または503の場合は、Retry-Afterの指定に従って待ってから再試行します。
コードを書く前に、必要な対象とその件数、必要なフィールド、希望する出力形式を私に質問してください。そのうえで、計画と概算費用を私に確認してください。リクエストパラメータ
#| 名前 | 場所 | 型 | 必須 | デフォルト | 説明 |
|---|---|---|---|---|---|
Authorization | header | string | はい | - | Bearerの後にAPIキーを続けます。APIキーはコンソールで作成してください。URLやコードリポジトリには絶対に含めないでください。 |
platform | body | string | はい | reddit | プラットフォームの識別子です。値は固定です。 |
action | body | string | はい | comments_lookup | 機能の識別子です。値は固定です。 |
comment_urls | body.params | array | はい | - | Reddit comment links for comments_lookup, as an array of up to 20 entries; a comma-separated string is not accepted. Each entry is the link to one comment itself, such as the url of a comment returned by comments: https://www.reddit.com/r/<subreddit>/comments/<post_id>/comment/<comment_id>/. The older /comments/<post_id>/<title>/<comment_id>/ form, old.reddit.com links and links with a query string such as ?context=3 also work. A comment ID alone is not enough, because Reddit finds a comment by post ID plus comment ID, and a post link is not a comment link. The url that user_comments returns points to the post, so it cannot be used here. List each comment once. A request with an unrecognized entry, a duplicate or more than 20 entries is rejected with a 422 before any charge, and so is a limit smaller than the number of entries. Billed per request, not per comment; comments not read (deleted, or not under that post) produce no row, so match the rows to your entries with input. A request that reads none is not charged. |
limit | body.params | integer (1–) | いいえ | - | この呼び出しで返す最大行数で、1以上の整数で指定します。省略するとデフォルト値が適用されます。また、返される行数がこれより少なくなる場合があります。 |
コードサンプル
#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_lookup",
"params": {
"comment_urls": [
"https://www.reddit.com/r/pics/comments/1xwxo1e/comment/19sogasefdc5g/"
]
}
}'OpenAPI定義(JSON)サンプルは環境変数EVERYINFRA_API_KEYからAPIキーを読み込みます。コピーしたコードにAPIキーが含まれることはありません。
レスポンス例
#{ "id": "req_…", "platform": "reddit", "action": "comments_lookup", "results": [ { "id": …, "text": …, "author_username": …, "like_count": …, "community": …, "url": …, "posted_at": …, "platform": …, "post_title": …, "post_url": …, "input": … } ], "count": …, "billing": { "charged": …, "charged_usd": …, "balance_after_usd": …, … }, "quota": { … }}
レスポンスフィールド
#業務データはresultsに含まれます。この表はレコードに含まれうるフィールドの一覧です。プラットフォームに表示されない値を作り出すことはありません。
| フィールド | 意味 |
|---|---|
id | プラットフォーム上でのレコードの一意なIDです。一意性は1つのプラットフォーム内に限られ、プラットフォームが異なるとIDが重複する場合があります。 |
text | HTMLを除去した本文です。省略されることなく全文が返されます(一部のプラットフォームでは一覧結果自体に抜粋しか含まれません。その場合は各プラットフォームのフィールドの注記に記載しています)。 |
author_username | 投稿者のユーザー名(@ハンドル)で、通常はURLに使用できます。 |
like_count | いいね数です。nullはプラットフォームまたはこの機能が公開していないことを示し、0ではありません。 |
community | プラットフォーム上の意味のまま |
url | プラットフォーム上のレコードへのリンクです。 |
posted_at | 投稿日時です。ISO 8601形式のUTCで返されます(例:2026-08-07T12:34:56+00:00)。プラットフォームから非標準の文字列が返された場合はそのまま渡されるため、パース処理は堅牢に実装してください。nullはプラットフォームが公開していないことを示します。 |
platform | 取得元プラットフォームの識別子で、リクエストのplatformと同じです(例:xiaohongshu、tiktok)。 |
post_title | コメントが付けられた投稿のタイトル(user_comments、comments_lookup、painpointのpain_comment行)。 |
post_url | Link to the post the comment was left on (comments_lookup). |
input | The entry that this row answers, returned exactly as you passed it: for posts_batch an entry of urls, for comments_lookup an entry of comment_urls. Use it to match rows to your entries; the returned url can be written differently, for example a full post link where you passed a redd.it short link. |
エラーと課金
#- 401
- キーが未指定か無効です。
- 402
- 残高が不足しています。先にチャージしてください。
- 422
- パラメータ名または値が無効です。エラーに含まれる候補を参考に修正してください。課金はされません。
- 429
- 1分あたりのリクエスト上限に達しました。Retry-Afterの指定に従って待ってから再試行してください。
- 503
- 処理を完了できませんでした。保留中の請求額は残高に戻されます。結果が不明な場合は、再試行する前に確認してください。
- 200(空)
- データがありません。課金はされません。