reddit-fetch-cli
v1.0.0
Published
Reddit data extraction CLI - Fetch posts, comments, users, and subreddit data. No API keys required. Export to JSON/CSV.
Maintainers
Readme
reddit-fetch
Reddit data extraction CLI. Fetch posts, comments, users, and subreddit data.
Installation
npm install -g reddit-fetch-cliUsage
# Get subreddit posts
reddit-fetch posts programming --limit 50
# User profile
reddit-fetch user spez
# Post with comments
reddit-fetch thread 1abc2de
# Search
reddit-fetch search "typescript tips" --subreddit programmingCommands
posts <subreddit>
Fetch posts from a subreddit.
reddit-fetch posts programming
reddit-fetch posts javascript --limit 100
reddit-fetch posts wallstreetbets --sort top --time week
reddit-fetch posts all --sort hotOptions:
--limit <n>- Number of posts (default: 25)--sort <type>- Sort: hot, new, top, rising, controversial--time <period>- Time filter for top/controversial: hour, day, week, month, year, all--after <id>- Pagination cursor
user <username>
Get user profile and posts.
reddit-fetch user spez
reddit-fetch user gallowboob --posts --limit 50
reddit-fetch user username --commentsOptions:
--posts- Include user's posts--comments- Include user's comments--limit <n>- Number of items
thread <id>
Get a post with all comments.
reddit-fetch thread 1abc2de
reddit-fetch thread 1abc2de --depth 3
reddit-fetch thread 1abc2de --sort bestOptions:
--depth <n>- Comment tree depth (default: all)--sort <type>- Sort: best, top, new, controversial, old
subreddit <name>
Get subreddit info.
reddit-fetch subreddit programming
reddit-fetch subreddit pics --rulessearch <query>
Search posts.
reddit-fetch search "best programming language"
reddit-fetch search "crypto" --subreddit cryptocurrency
reddit-fetch search "news" --sort relevance --time monthOptions:
--subreddit <name>- Limit to specific subreddit--sort <type>- Sort: relevance, hot, top, new, comments--time <period>- Time filter--limit <n>- Number of results
Output Formats
# JSON (default)
reddit-fetch posts programming
# Table view
reddit-fetch posts programming -o table
# CSV
reddit-fetch posts programming -o csv > posts.csv
# Save to file
reddit-fetch user spez --save user.jsonExample Output
{
"posts": [
{
"id": "1abc2de",
"title": "Why I love TypeScript",
"author": "devuser",
"subreddit": "programming",
"score": 1523,
"upvoteRatio": 0.94,
"numComments": 234,
"created": "2024-01-15T10:30:00Z",
"url": "https://reddit.com/r/programming/comments/1abc2de",
"selftext": "Here's my experience with...",
"flair": "Discussion"
}
],
"after": "t3_1xyz789"
}Batch Processing
# Multiple subreddits
for sub in programming javascript typescript; do
reddit-fetch posts $sub --limit 100 > ${sub}.json
done
# Continuous monitoring
watch -n 60 "reddit-fetch posts wallstreetbets --sort new --limit 10"Rate Limiting
reddit-fetch includes built-in rate limiting to respect Reddit's guidelines. For heavy usage, add delays:
reddit-fetch posts programming --delay 2000 # 2 second delay between requestsWhy reddit-fetch?
- No API credentials - Works without Reddit app registration
- Fast - Efficient data extraction
- Comprehensive - Posts, comments, users, subreddits
- Multiple formats - JSON, CSV, table output
- Pagination - Handle large datasets with
--after
Built by LXGIC Studios
