Skip to main content

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:

  1. Fetches the Reddit thread using Reddit's JSON API
  2. Converts the submission title, self-text, and comment tree into Markdown
  3. Preserves comment hierarchy with indentation (2 spaces per nesting level)
  4. Each comment is formatted as: - **u/username**: comment body
  5. 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)

Source distribution for llm-fragments-reddit 0.1.1
File Size Uploaded
llm_fragments_reddit-0.1.1.tar.gz 4.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for llm-fragments-reddit 0.1.1
File Interpreter ABI Platform
llm_fragments_reddit-0.1.1-py3-none-any.whl Python 3 none any Details

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

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page