Sand AISand AI MAGI-2MAGI-2 現已登上 SandBase:支援原生音訊的 1080p 影片立即試用

Reddit Post Comments

API 文件
https://api.sandbase.ai/v1/api/reddit/post-comments

List the comments on a Reddit post by URL (author, body, score, timestamp, parent comment). Replies carry the parentId of the comment they answer.

價格
自 $0.0006 起美元/次呼叫
方法
POST
回應
JSON
參數
1 個必填 · 1 個選填

Playground

輸入
Full Reddit post URL on reddit.com. A gallery link (https://www.reddit.com/gallery/<id>) is read as the post it belongs to, and a relative permalink (/r/<subreddit>/comments/<id>/...) as the same path on https://www.reddit.com.
Cursor from a previous response for more comments.
輸出就緒

您的輸出會顯示在這裡

完成輸入後,點擊執行。

API README

Reddit Post Comments API

Returns the comments on a Reddit post, with author, body, score, creation time and the parent comment for each reply. It needs the full URL of the post as url.

Use cases

  • Collect the replies to a popular AMA to study which questions got the most upvotes.
  • Rebuild a comment thread as a tree by matching each parentId to a comment id.
  • Pull the top-scored comments on a post to summarize what readers think.
  • Link each comment back to its page on Reddit using its url to review or moderate it.

Request

curl -X POST "https://api.sandbase.ai/v1/api/reddit/post-comments" \
  -H "Authorization: Bearer $SANDBASE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://www.reddit.com/r/IAmA/comments/z1c9z/i_am_barack_obama_president_of_the_united_states/"}'

The result is returned in outputs[0].data.

Parameters

NameTypeRequiredDescription
urlstringYesFull Reddit post URL on reddit.com. A gallery link (https://www.reddit.com/gallery/<id>) is read as the post it belongs to, and a relative permalink (/r/<subreddit>/comments/<id>/...) as the same path on https://www.redd
cursorstringNoCursor from a previous response for more comments.

Example response

Real response for the request above, trimmed: lists keep their first item and long strings are cut.

{
  "data": {
    "comments": [
      {
        "author": "Biinaryy",
        "body": "Here is a collection of all the questions and answers:\n\nQuestion: [Link](http://…",
        "createdUtc": 1346276659,
        "id": "c60o0iw",
        "parentId": "",
        "score": 5399,
        "url": "https://www.reddit.com/r/IAmA/comments/z1c9z/i_am_barack_obama_president_of_the_…"
      }
    ],
    "media": null,
    "nextCursor": "cur_E_QuTid3jKG5pjQCweyA_g"
  },
  "found": true
}

Response fields

FieldMeaning
data.comments[].authorReddit username of the person who wrote the comment.
data.comments[].bodyText of the comment. It uses Reddit markdown, so links and emphasis appear as markdown.
data.comments[].idID of the comment, for example c60o0iw. Replies point to it in parentId.
data.comments[].parentIdThe id of the comment this one answers. It is an empty string for a top-level comment.
data.comments[].scoreScore of the comment, as a number.
data.comments[].createdUtcCreation time of the comment as a Unix timestamp in seconds (UTC).
data.comments[].urlDirect link to the comment on reddit.com.
data.nextCursorCursor for the next page of comments. Send it as cursor in the next request.
data.mediaMedia attached to the post. It is null in this response.
foundtrue when the post was found. A lookup that finds nothing returns false.

Notes

Need to find a thread first? Search posts within one subreddit. Then follow the Python request walkthrough to read a selected thread without assuming complete comment coverage.

  • Copy the post URL from Reddit. A gallery link or a relative permalink such as /r/<subreddit>/comments/<id>/... also works.
  • To get more comments, repeat the request with the same url and the nextCursor value as cursor.
  • Comments are listed in a flat array. Use parentId to see which comment each reply answers.

Pricing

Billed at the actual cost of each call, about $0.0006 for the request above. Failed calls are not charged.

探索更多

相關 APIs

所有 APIs
API價格回應
Reddit每次呼叫 $0.0006 起JSON
Reddit每次呼叫 $0.001JSON
Reddit每次呼叫 $0.001JSON
Reddit每次呼叫 $0.001JSON
Reddit每次呼叫 $0.001JSON
Reddit每次呼叫 $0.001JSON

指南:Best Reddit API in 2026: Pricing Compared

問題

常見問題

我要如何使用 Reddit Post Comments API?

使用 POST 請求將您的 SandBase API 金鑰放在 Authorization 標頭(Bearer)中,並以 JSON 主體傳入參數,即可呼叫 https://api.sandbase.ai/v1/api/reddit/post-comments。您也可以直接在本頁的 Playground 試用,不必撰寫程式碼。

Reddit Post Comments API 的費用是多少?

每次起 $0.0006,並從您的 SandBase 餘額中扣款。您只會為實際發出的呼叫付費;沒有訂閱方案。

Reddit Post Comments API 接受哪些參數?

必要:url (string)。 選填:cursor (string)。 本頁的 Parameters 表格與 Playground 會列出每個欄位。

Reddit Post Comments API 會回傳什麼?

在同一個 HTTP 請求中回傳的 JSON 回應(同步)。 本頁的 README 包含範例回應。

我需要 Reddit 開發者帳號或 API 金鑰嗎?

不需要。Reddit Post Comments 是透過 SandBase 運作,因此一組 SandBase API 金鑰即可使用此端點以及目錄中的其他所有 API 和模型。您不需要另外申請 Reddit API 存取權。

我應該傳 post ID 還是 URL 給這個 Comments API?

這個端點接受 Reddit 貼文 URL 作為 url,另外可選 cursor。教學請使用完整的公開貼文 URL。app 的 Post Comments 變體有獨立的請求合約;不要把它的 post_id 或 after 參數複製到這裡。

我要如何保留回覆關係並讀取更多留言?

參考文件描述的是扁平的 data.comments 陣列。將 parentId 對應到父留言的 id;parentId 為空字串表示頂層留言。被參照的父留言可能不會出現在您抓取的頁面中,因此請保留該缺失關係,不要把回覆當作頂層留言。如果回傳了完整的 data.nextCursor,請與相同的貼文 URL 一起將它作為 cursor 傳送。單一回應無法保證整個討論串完整。

這個端點會做情緒分析,或搜尋每一則 Reddit 留言嗎?

不會。它只會讀取您提供的貼文 URL 的留言。解讀情緒是另一個分析步驟,而抽樣討論串不能代表整個社群。分數和使用者名稱只是脈絡,不是事實驗證。請只使用公開資料,並遵守適用的平台與使用規則。