Skip to content

spinov001-art/python-reddit-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

Python Reddit API Client — No API Key Required

Access Reddit data without OAuth, API keys, or registration. Get posts, comments, subreddit stats, and search results using Reddit's public JSON endpoints.

The Problem

Reddit's official API requires:

  1. Create a Reddit app
  2. Get OAuth credentials
  3. Handle token refresh
  4. Deal with rate limits

This client skips all of that. It uses Reddit's public .json endpoints — the same ones that power old.reddit.com.

Quick Start

git clone https://github.com/spinov001-art/python-reddit-api.git
cd python-reddit-api
python reddit_api.py

No dependencies. No API key. Just Python 3.6+.

What You Can Do

Get Subreddit Posts

from reddit_api import RedditClient

client = RedditClient()
posts = client.get_subreddit_posts("python", sort="top", limit=10, time_filter="week")

for post in posts:
    print(f"[{post['score']}] {post['title']}")

Search Reddit

results = client.search("web scraping python", sort="relevance", limit=20)
for r in results:
    print(f"r/{r['subreddit']}: {r['title']} ({r['score']} pts)")

Get Comments

comments = client.get_comments("python", "abc123", limit=50)
for c in comments:
    print(f"u/{c['author']} ({c['score']} pts): {c['body'][:100]}")

Get Subreddit Info

info = client.get_subreddit_info("datascience")
print(f"Subscribers: {info['subscribers']:,}")
print(f"Active now: {info['active_users']:,}")

Data Fields

Posts

Field Type Description
id str Post ID
title str Post title
author str Username
score int Net upvotes
upvote_ratio float % upvoted
num_comments int Comment count
url str Link URL
selftext str Post body (text posts)
subreddit str Subreddit name
permalink str Full Reddit URL
flair str Post flair

Use Cases

  • Market research: What do people say about your product?
  • Content ideas: What questions get the most upvotes?
  • Sentiment analysis: Track brand mentions across subreddits
  • Trend detection: Monitor emerging topics in any niche
  • Dataset building: Collect training data for NLP models

Limitations

  • Public endpoints only (no private subreddits)
  • ~60 requests/minute rate limit
  • Max 100 posts per request (use pagination for more)
  • Some subreddits may block non-authenticated requests

Related Projects

License

MIT

About

Python Reddit API client — no API key required. Get posts, comments, subreddit stats.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages