npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, πŸ‘‹, I’m Ryan HefnerΒ  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you πŸ™

Β© 2026 – Pkg Stats / Ryan Hefner

reddit-fetch-pro

v1.0.0

Published

πŸš€ Modern Reddit data fetcher for subreddits and user profiles with clean JSON output

Readme

πŸš€ Reddit Fetch Pro

A modern, lightweight Node.js package for fetching data from Reddit subreddits and user profiles.

npm version License: MIT Node.js Version

πŸ“₯ Installation

npm install reddit-fetch-pro

πŸ” About

Reddit Fetch Pro is a powerful yet simple package for retrieving data from Reddit. It supports fetching posts from both subreddits and user profiles with clean, structured JSON output. Perfect for building Reddit-powered applications, bots, and data analysis tools.

✨ Features

  • 🧩 Simple API: Easy to use with minimal setup
  • πŸ”„ Dual Fetching: Get data from both subreddits and user profiles
  • πŸ”’ Customizable Limits: Control how many posts to retrieve
  • πŸ“Š Rich Metadata: Each post comes with comprehensive details
  • ⏱️ Proper Timestamps: Correctly formatted dates for all posts
  • πŸ” Error Handling: Robust error management with helpful messages

πŸ”§ Usage

πŸ‘€ Fetch User Posts

const reddit = require("reddit-fetch-pro");

// Get posts from a user profile
reddit({
    search: "spez",         // Reddit username
    limits: 3,              // Optional: Number of posts to retrieve
    type: "user"            // Specify user profile fetch
})
.then(response => {
    console.log(response);
    /*
    Output:
    {
        data: [
            {
                title: 'Announcing Reddit Talk...',
                image: 'https://www.reddit.com/r/...',
                link: 'https://www.reddit.com/r/...',
                like: 12580,
                dislike: 0,
                comment: 4378,
                subredditName: 'r/reddit',
                author: 'spez',
                dateCreated_UTC: 'Feb 25, 2025 3:21 PM',
                subreddit: 'reddit',
                id: 'xyz789',
                voteRatio: 0.87,
                nsfw: false
            },
            // More posts...
        ]
    }
    */
})
.catch(error => {
    console.log(error);
});

πŸ“• Fetch from Subreddit

const reddit = require("reddit-fetch-pro");

// Get posts from a subreddit
reddit({
    search: "programming",  // Subreddit name
    limits: 5               // Optional: Number of posts to retrieve
})
.then(response => {
    console.log(response);
    /*
    Output:
    {
        data: [
            {
                title: 'What programming books had the biggest impact on you?',
                image: 'https://www.reddit.com/r/programming/comments/...',
                link: 'https://www.reddit.com/r/programming/comments/...',
                like: 342,
                dislike: 0,
                comment: 127,
                subredditName: 'r/programming',
                author: 'username123',
                dateCreated_UTC: 'Feb 27, 2025 8:45 PM',
                subreddit: 'programming',
                id: 'abc123',
                voteRatio: 0.95,
                nsfw: false
            },
            // More posts...
        ]
    }
    */
})
.catch(error => {
    console.log(error);
});

πŸ”’ Customize Post Limits

// Get only 2 posts from r/news
reddit({
    search: "news",
    limits: 2
})
.then(response => {
    console.log(`Found ${response.data.length} posts`);
})
.catch(error => {
    console.log(error);
});

πŸ“Š Response Structure

Each post in the response contains the following information:

| Field | Type | Description | |-------|------|-------------| | title | String | The title of the post | | image | String | URL of the post's image or content | | link | String | Full permalink to the Reddit post | | like | Number | Upvote count | | dislike | Number | Downvote count | | comment | Number | Comment count | | subredditName | String | Formatted subreddit name (e.g., "r/programming") | | author | String | Username of the post's author | | dateCreated_UTC | String | Human-readable creation date | | subreddit | String | Raw subreddit name | | id | String | Unique Reddit post ID | | voteRatio | Number | Ratio of upvotes to total votes (0.0-1.0) | | nsfw | Boolean | Whether the post is marked NSFW |

❓ FAQ

Q: Can I use this for commercial projects?
A: Yes! This package is MIT licensed, which allows for commercial use.

Q: Is there a rate limit?
A: This package uses the Reddit public API, which has rate limits. For high-volume applications, consider implementing a delay between requests.

Q: Can I fetch comments?
A: Currently, the package only fetches post data. Comment fetching may be added in future updates.

πŸ› οΈ Error Handling

The package uses promise-based error handling. Always implement a .catch() block to handle potential errors:

reddit({
    search: "non_existent_subreddit"
})
.then(response => {
    console.log(response);
})
.catch(error => {
    console.error("Error occurred:", error.message);
});

πŸ”œ Upcoming Features

  • πŸ’¬ Comment fetching
  • πŸ”„ Pagination support
  • πŸ” Advanced search options
  • πŸ“Š Analytics and statistics

🀝 Contributing

Contributions are welcome! Feel free to submit a pull request or open an issue on GitHub.

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ“« Contact

For bugs, feature requests, or other questions: