reddit-fetch
Installation
SKILL.md
Reddit Fetch
Reddit's public JSON API works by appending .json to any Reddit URL. All curl examples below need a browser User-Agent header - export it once and reuse it:
UA="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
Endpoints
# Listing - swap hot for new/top/rising; for top add &t=day|week|month|year|all
curl -s -L -H "User-Agent: $UA" "https://old.reddit.com/r/SUBREDDIT/hot.json?limit=15"
# Post + comments - JSON array where [0]=post, [1]=comment tree
curl -s -L -H "User-Agent: $UA" "https://old.reddit.com/r/SUBREDDIT/comments/POST_ID.json?limit=20"
# Search within a subreddit
curl -s -L -H "User-Agent: $UA" "https://old.reddit.com/r/SUBREDDIT/search.json?q=QUERY&restrict_sr=on&sort=new&limit=15"