# How do I export all the comments from a Reddit thread for analysis?

> Turn a Reddit thread into rows with text, author, score, time and parent ID, using one cursor instead of expanding 'more comments' links. Cost per thread, Python to CSV, limits.

Canonical page: https://okdata.online/answers/export-reddit-thread-comments/

**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](/apis/reddit/posts/comments/list/) returns the thread as flat rows, page by page, behind one cursor.

## Steps

1. **Check the size.** [Reddit post detail](/apis/reddit/posts/get/) ($0.002) returns the title, full text, score, upvote ratio and comment count.
2. **Pick an order.** `sort=best` is Reddit's default order, `popular` puts the highest-scored comments first, and `latest` the newest.
3. **Page through.** Pass `url`, or the post ID with or without `t3_`, and follow `page.next_cursor`.
4. **Rebuild the tree.** Rows whose `parent_id` is null are top-level comments. Every other row names the comment it answers.

## Python to CSV

```python
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.
- `likes` holds 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](/apis/reddit/posts/transcript/get/) ($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](/solutions/word-of-mouth/) covers comment analysis across platforms.

## Endpoints used

- [Reddit post comments](https://okdata.online/apis/reddit/posts/comments/list/) `reddit.posts.comments.list`: $0.002 per call · about 10 comments per page
- [Reddit post detail](https://okdata.online/apis/reddit/posts/get/) `reddit.posts.get`: $0.002 per call
- [Reddit video transcript](https://okdata.online/apis/reddit/posts/transcript/get/) `reddit.posts.transcript.get`: $0.004 per call

## More about Reddit

- [Reddit API](https://okdata.online/apis/reddit/)
- [How to search Reddit posts by keyword and collect their comments](https://okdata.online/guides/reddit-search-posts-and-comments/)
- [How do I get Reddit posts and comments into an AI agent?](https://okdata.online/answers/reddit-posts-comments-ai-agent/)
- [How do I monitor Reddit for new posts that mention my brand?](https://okdata.online/answers/monitor-brand-mentions-reddit/)
- [How much does the Reddit API cost in 2026, and can a small project still get access?](https://okdata.online/answers/reddit-api-pricing-2026/)
- [Is there an MCP server that lets Cursor search TikTok, Instagram and Reddit?](https://okdata.online/answers/cursor-mcp-tiktok-instagram-reddit/)
- [Comments API](https://okdata.online/roles/posts-comments-list/)
- [Post detail API](https://okdata.online/roles/posts-get/)
- [Transcript API](https://okdata.online/roles/transcripts-get/)
- [Reddit trending searches: today’s list](https://okdata.online/tools/hot-search/reddit/)

## Sources

Where people asked this (read 2026-11-15): 

- https://stackoverflow.com/questions/36366388
- https://stackoverflow.com/questions/66178703

Updated 2026-11-15
