Answers
How do I export all the comments from a Reddit thread for analysis?
Short answer
Pass the thread's link to Reddit post comments and follow `cursor` until `has_more` is false. Each page holds about 10 comments with the first levels of replies under them, for $0.002, so budget $0.20 per 1,000 comments. Every row has text, author, score, time and `parent_id`, which is enough to rebuild the reply tree.
A UX researcher has five r/BuyItForLife threads about vacuum cleaners, 300 to 1,500 comments each, and wants every comment as a row to tag by theme. Reddit's official API returns a thread as a tree with "load more comments" stubs, and each stub needs another request. That is why expanding a big thread through it is slow, and why the after parameter that pages through a community does nothing for comments. Reddit also stopped accepting new requests for that API on 31 October 2026.
Reddit post comments returns the thread as flat rows, page by page, behind one cursor.
Steps
- Check the size. Reddit post detail ($0.002) returns the title, full text, score, upvote ratio and comment count.
- Pick an order.
sort=bestis Reddit's default order,popularputs the highest-scored comments first, andlatestthe newest. - Page through. Pass
url, or the post ID with or withoutt3_, and followpage.next_cursor. - Rebuild the tree. Rows whose
parent_idis null are top-level comments. Every other row names the comment it answers.
Python to CSV
import csv, os, requests
API = "https://api.okdata.online"
H = {"Authorization": f"Bearer {os.environ['OKDATA_API_KEY']}"}
THREAD = "https://www.reddit.com/r/nasa/comments/1nnrvkr/" # any thread link
rows, cursor = [], None
for _ in range(300): # a hard stop for very large threads
params = {"url": THREAD, "sort": "best", **({"cursor": cursor} if cursor else {})}
body = requests.get(API + "/v1/reddit/posts/comments/list", headers=H, params=params, timeout=60).json()
if body["code"] != "ok":
raise RuntimeError(f"{body['code']}: {body['message']}")
rows += body["data"]["items"]
if not body["page"]["has_more"]:
break
cursor = body["page"]["next_cursor"]
with open("thread.csv", "w", newline="", encoding="utf-8") as f:
w = csv.writer(f)
w.writerow(["id", "parent_id", "author", "score", "replies", "published_at", "text"])
for c in rows:
w.writerow([c["id"], c["parent_id"] or "", c["author"]["username"], c["likes"], c["replies"],
c["published_at"], c["text"]])
print(len(rows), "comments")
pandas.read_csv("thread.csv") turns the file into a dataframe you can tag, count, or hand to a model in batches.
Cost
| Thread | Pages (about) | Cost |
|---|---|---|
| 200 comments | 20 | $0.04 |
| 1,000 comments | 100 | $0.20 |
| Five threads, 4,000 comments in all | 400 | $0.80 |
Replies arrive on the same page as the comment they answer, so a thread with many replies usually needs fewer pages than this.
Limits
- Replies come back to the first few levels. Very deep back-and-forth chains are cut off, so compare your row count with the comment count from post detail.
- That count also includes comments that were removed or deleted, so your file will usually be shorter even for a shallow thread.
likesholds the comment's score, Reddit's net of upvotes and downvotes, not a count of likes.- Usernames are personal data. For research, replace them with stable pseudonyms before you share the file, and drop comments that were later deleted on Reddit, as Reddit requires of its own API users.
- If the thread is a video post, Reddit video transcript ($0.004) adds what is said in it. A video without captions is still charged as one call.
Other routes
If you already hold Data API access, the official API keeps working until Reddit closes public access in March 2027. Academic researchers can ask Reddit about r/reddit4researchers, its research access program. For a single thread, saving the page by hand works once every "load more comments" link has been opened. The word-of-mouth page covers comment analysis across platforms.
Sources
Where people asked this (read 2026-11-15)
Updated