llm-fragments-reddit
A plugin for llm that loads Reddit threads as fragments, making it easy to analyze and summarize Reddit discussions with large language models.
Features
- Load entire Reddit threads (submission + comments) as LLM fragments
- Support for both Reddit URLs and submission IDs
- Preserves comment hierarchy with proper indentation
- Converts threads to clean Markdown format
- Handles deleted comments and "load more" placeholders gracefully
Installation
Install using pip:
llm install llm-fragments-reddit
Or for development:
git clone https://github.com/banteg/llm-fragments-reddit
cd llm-fragments-reddit
pip install -e .
Usage
The plugin adds a reddit fragment loader to the llm command. You can use it in two ways:
Using Reddit URLs
llm -f reddit:https://www.reddit.com/r/Python/comments/abc123/my_thread/ "summarize the key ideas"
Using Submission IDs
llm -f reddit:abc123 "extract the main arguments from this discussion"
How it works
The plugin:
- Fetches the Reddit thread using Reddit's JSON API
- Converts the submission title, self-text, and comment tree into Markdown
- Preserves comment hierarchy with indentation (2 spaces per nesting level)
- Each comment is formatted as:
- **u/username**: comment body - Returns the entire thread as a single fragment for LLM processing
Output Format
The generated fragment includes:
- Thread title as H1 header
- Original post content (if any)
- Nested comment tree with proper indentation
- Author attribution for each comment
Example output structure:
# DAE think Reddit is becoming too mainstream?
I've been on Reddit for 7 years (this is my alt account) and I swear the quality of discourse has really declined. Back in my day we had actual discussions instead of just memes and karma farming.
---
- **u/NostalgicRedditor2016**: This. So much this. I remember when you could have nuanced discussions without getting downvoted to oblivion.
- **u/ActuallyIm14**: OK boomer. Reddit was always trash, you just got older and realized it.
- **u/NostalgicRedditor2016**: I'm 23 but go off I guess
- **u/GrammarNaziPatrol**: *you're
- **u/NostalgicRedditor2016**: No, "you" is correct there. Maybe learn grammar before correcting others?
- **u/GrammarNaziPatrol**: Edit: Thanks for the gold, kind stranger!
- **u/RedditExpert2024**: Unpopular opinion but Reddit has always been a circlejerk. The real issue is people thinking upvotes = truth
- **u/PhilosophyUndergrad**: This is a profound observation. As Nietzsche once said... [3000 word comment about nihilism]
- **u/SkippedTheReading**: TL;DR?
- **u/PowerModerator**: Locked. Y'all can't behave.
Requirements
- Python ≥ 3.12
- llm ≥ 0.26
- requests ≥ 2.32.3
License
MIT License - see the source code for details.
Author
Created by banteg
Metadata
Release files for llm-fragments-reddit 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| llm_fragments_reddit-0.1.1.tar.gz | 4.2 kB | Without provenance | Details for llm_fragments_reddit-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| llm_fragments_reddit-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for llm_fragments_reddit-0.1.1-py3-none-any.whl |
Total release size: 9.0 kB
Release files / llm_fragments_reddit-0.1.1.tar.gz
| Download URL | llm_fragments_reddit-0.1.1.tar.gz |
|---|---|
| Size | 4.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ae2a7656e70662855425f0ef215da17854a363b89be2cd8c5beb12e4c143d73c
|
|
BLAKE2b-256 checksum How to use checksums |
0495fd8d1099fe258102829fe36b2f359155b021271b1aba18f3da02f0ce6342
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.3
|
Release files / llm_fragments_reddit-0.1.1-py3-none-any.whl
| Download URL | llm_fragments_reddit-0.1.1-py3-none-any.whl |
|---|---|
| Size | 4.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0a91fbde5a8f3ff71fdcbac773b7c33c33158565dc6a45d568a82a5ef7354ab3
|
|
BLAKE2b-256 checksum How to use checksums |
772cbfca65766c2c64767d237d0a44db9214a136543074fd777388e9fdf708ce
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.3
|
Security for llm-fragments-reddit 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.