reddit-access
Access Reddit content by parsing old.reddit.com HTML pages.
Prerequisites
- Python 3
- uv (dependencies are managed inline via script metadata)
Commands
Get subreddit posts
uv run ~/.agents/skills/reddit-access/scripts/reddit.py posts <subreddit> [limit] [sort]
subreddit: Subreddit name (without r/)limit: Number of posts (default: 25, max: 100)sort: Sort order -hot,new,top,rising(default: hot)
Example:
uv run ~/.agents/skills/reddit-access/scripts/reddit.py posts python 10 hot
Output:
[
{
"id": "abc123",
"title": "Post title",
"author": "username",
"score": 42,
"num_comments": 15,
"url": "https://old.reddit.com/r/python/comments/abc123/...",
"created_utc": 1234567890
}
]
Get post details with comments
With post ID:
uv run ~/.agents/skills/reddit-access/scripts/reddit.py details <post_id> [subreddit]
With URL:
uv run ~/.agents/skills/reddit-access/scripts/reddit.py details <url>
post_id: Reddit post IDsubreddit: Optional subreddit name for faster lookup (when using post ID)url: Full Reddit URL (new or old Reddit format)
Example with post ID:
uv run ~/.agents/skills/reddit-access/scripts/reddit.py details abc123 python
Example with new Reddit URL:
uv run ~/.agents/skills/reddit-access/scripts/reddit.py details "https://www.reddit.com/r/python/comments/abc123/post_title/"
Output:
{
"post": {
"title": "Post title",
"selftext": "Post content...",
"author": "username",
"score": 42
},
"comments": [
{
"author": "commenter",
"body": "Comment text",
"score": 10
}
]
}
Search within subreddit
uv run ~/.agents/skills/reddit-access/scripts/reddit.py search <subreddit> <query> [limit]
subreddit: Subreddit to search inquery: Search querylimit: Number of results (default: 25)
Example:
uv run ~/.agents/skills/reddit-access/scripts/reddit.py search python "async await" 10
Get user posts
uv run ~/.agents/skills/reddit-access/scripts/reddit.py user <username> [limit]
username: Reddit username (without u/)limit: Number of posts (default: 25)
Example:
uv run ~/.agents/skills/reddit-access/scripts/reddit.py user rewselab 10
Common Workflows
Read a Reddit post from URL
# Simply pass the Reddit URL (new or old Reddit)
uv run ~/.agents/skills/reddit-access/scripts/reddit.py details "https://www.reddit.com/r/python/comments/abc123/post_title/"
Read discussion
# Get post and read comments
uv run ~/.agents/skills/reddit-access/scripts/reddit.py details abc123 python
Monitor trending topics
# Get hot posts from multiple subreddits
uv run ~/.agents/skills/reddit-access/scripts/reddit.py posts programming 15 hot
uv run ~/.agents/skills/reddit-access/scripts/reddit.py posts python 15 hot
uv run ~/.agents/skills/reddit-access/scripts/reddit.py posts MachineLearning 15 hot
Research a topic
# Search across relevant subreddits
uv run ~/.agents/skills/reddit-access/scripts/reddit.py search python "type hints" 20
uv run ~/.agents/skills/reddit-access/scripts/reddit.py search learnpython "type hints" 20
Track user activity
# Get recent posts from a user
uv run ~/.agents/skills/reddit-access/scripts/reddit.py user username 25
Notes
- Parses
old.reddit.comHTML pages (no API key or auth required) - Rate limiting: Be respectful, avoid rapid requests
- User-Agent is set to a browser string to avoid blocks
- All output is JSON format
- Dependencies managed inline via uv script metadata (beautifulsoup4)
- Works with public content only (no private subreddits or user data)
Error Handling
Errors are returned as JSON to stderr:
{
"error": "Error message"
}
Common errors:
- Subreddit not found (404)
- Post not found (404)
- Rate limited (429) - wait and retry
- Network timeout - retry with exponential backoff