Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

reddit-auto

Reddit parser for w_popularity.

Strategy

  • Primary: public JSON API at https://www.reddit.com/user/<handle>/about.json (channel) and /user/<handle>/submitted.json?limit=50 (recent posts).
  • OAuth (optional): set Config.BearerToken to talk to oauth.reddit.com instead — bumps anon 10 req/min to 100 req/min.
  • No browser fallback needed; Reddit's anonymous JSON endpoints are stable.

Field mapping

Reddit ChannelSnapshot
subreddit.subscribers (preferred) or total_karma (fallback) Followers
total_karma TotalLikes
link_karma, comment_karma, awardee_karma, awarder_karma, is_gold, is_mod, created_utc, icon_img, bio Raw

For posts: score → Likes, num_comments → Comments, permalink → URL.

Caveats

  • Reddit requires a unique, descriptive User-Agent. The default UA (w_popularity/1.0 …) satisfies that. Don't override with a curl-default or you'll get 429s.
  • Personal-subreddit subscriber count (u/<user>) is often 0 for users who never opted into the personal-subreddit feature — that's why karma is the fallback.
  • Anonymous quota: 10 req/min per IP. Use BearerToken for higher limits in production.

Usage

import parser "github.com/suenot/reddit-auto"

p := parser.New(parser.Config{})
snap, err := p.FetchChannel(ctx, "suenot")
posts, err := p.FetchRecentPosts(ctx, "suenot", time.Now().AddDate(0, -1, 0))

License

MIT

About

Reddit parser for w_popularity

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages