reddit

package module
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 13, 2026 License: MIT Imports: 12 Imported by: 0

README

Reddit clients for Crawlora

Official Crawlora client packages for the hosted Reddit API. Access 39 API endpoints covering search, post and comment details, subreddit feeds, user history, domain listings, trends, and leads from JavaScript/TypeScript, Python, Go, Ruby, Java, PHP, and Rust. These clients call Crawlora's hosted API; they do not scrape Reddit locally. Requests use your Crawlora account and CRAWLORA_API_KEY; service usage follows your account billing plan. Crawlora is independent from and not affiliated with or endorsed by Reddit or its owners.

Language packages

For installation and runnable examples, use the README for your language. See the API endpoint and parameter reference for shared operation details.

Create an account at crawlora.net, open the Crawlora console to get an API key, or read the API documentation. Keep CRAWLORA_API_KEY out of source control.

API coverage and supported endpoints

The seven language clients provide access to all 39 selected public Reddit API operations. Search or browse by endpoint path and operation ID below; the complete API reference adds parameters, enums, and response details.

Method Endpoint API operation Description
GET /reddit/archive/comments/ids reddit-archive-comments-ids Look up archived Reddit comments by ids
GET /reddit/archive/comments/search reddit-archive-comments-search Search archived Reddit comments
GET /reddit/archive/comments/{id}/tree reddit-archive-comments-tree Get an archived Reddit comment tree
GET /reddit/archive/posts/ids reddit-archive-posts-ids Look up archived Reddit posts by ids
GET /reddit/archive/posts/search reddit-archive-posts-search Search archived Reddit posts
GET /reddit/archive/subreddits/search reddit-archive-subreddits-search Search Reddit's archived subreddit directory
GET /reddit/archive/time-series reddit-archive-time-series Get historical Reddit archive time series
GET /reddit/comment/{id} reddit-comment Get a Reddit comment
GET /reddit/comment/{id}/awards reddit-comment-awards Get Reddit comment awards
GET /reddit/comments/{id} reddit-comments Get Reddit post comments
GET /reddit/domain/{domain}/posts reddit-domain-posts List Reddit domain posts
GET /reddit/leads reddit-leads Find Reddit buying-intent leads
GET /reddit/popular reddit-popular List Reddit popular posts
GET /reddit/post/{id} reddit-post Get Reddit post
GET /reddit/post/{id}/awards reddit-post-awards Get Reddit post awards
GET /reddit/posts/ids reddit-posts-by-ids Get Reddit posts by ids
GET /reddit/search reddit-search Search Reddit posts
GET /reddit/search/comments reddit-search-comments Search Reddit comments
GET /reddit/search/people reddit-search-people Search Reddit people
GET /reddit/subreddit/{subreddit}/about reddit-subreddit-about Get Reddit subreddit metadata
GET /reddit/subreddit/{subreddit}/comments reddit-subreddit-comments List Reddit subreddit comments
GET /reddit/subreddit/{subreddit}/flairs reddit-subreddit-flairs List Reddit community post flairs
GET /reddit/subreddit/{subreddit}/highlights reddit-subreddit-highlights List Reddit community highlights
GET /reddit/subreddit/{subreddit}/leaderboard/categories reddit-subreddit-leaderboard-categories List Reddit community leaderboard categories
GET /reddit/subreddit/{subreddit}/posts reddit-subreddit-posts List Reddit subreddit posts
GET /reddit/subreddit/{subreddit}/rules reddit-subreddit-rules Get Reddit community rules
GET /reddit/subreddit/{subreddit}/user-flairs reddit-subreddit-user-flairs List Reddit community user flairs
GET /reddit/subreddit/{subreddit}/wiki reddit-subreddit-wiki Get Reddit community wiki
GET /reddit/subreddits/discover reddit-subreddits-discover List Reddit community discovery feeds
GET /reddit/subreddits/posts reddit-subreddits-posts List Reddit multi-subreddit posts
GET /reddit/subreddits/search reddit-subreddits-search Search Reddit communities
GET /reddit/subreddits/suggest reddit-subreddits-suggest Suggest Reddit communities
GET /reddit/topics reddit-topics List Reddit taxonomy topics
GET /reddit/topics/broad reddit-topics-broad List Reddit broad topics
GET /reddit/topics/search reddit-topics-search Search Reddit topics
GET /reddit/trends reddit-trends List Reddit trends
GET /reddit/user/{username}/comments reddit-user-comments List Reddit user comments
GET /reddit/user/{username}/posts reddit-user-posts List Reddit user posts
GET /reddit/user/{username}/profile reddit-user-profile Get a Reddit user profile

License

MIT. See LICENSE.

Documentation

Overview

Package reddit is Crawlora's Reddit API client for 39 endpoints, covering search, post and comment details, subreddit feeds, user history, domain listings, trends, and leads. API documentation: https://crawlora.net/docs?utm_source=pkg.go.dev&utm_medium=referral&utm_campaign=platform-clients&utm_content=reddit-go-api-docs

Index

Examples

Constants

View Source
const (
	DefaultBaseURL = "https://api.crawlora.net/api/v1"
	Version        = "0.3.0"
)
View Source
const OperationCount = 39

OperationCount reports how many selected-platform operations this module exposes.

Variables

This section is empty.

Functions

func OperationIDs

func OperationIDs() []string

OperationIDs returns the selected operation IDs in stable sorted order.

Types

type Client

type Client struct {
	APIKey     string
	BaseURL    string
	Timeout    time.Duration
	HTTPClient *http.Client
}

Client calls only the operation IDs included in this platform module.

func NewClient

func NewClient(apiKey string) *Client

NewClient creates a client using the supplied API key, or CRAWLORA_API_KEY when empty.

func (*Client) ArchiveCommentsIds added in v0.3.0

func (c *Client) ArchiveCommentsIds(ctx context.Context, params Params) (any, error)

ArchiveCommentsIds calls the reddit-archive-comments-ids operation.

func (*Client) ArchiveCommentsSearch added in v0.3.0

func (c *Client) ArchiveCommentsSearch(ctx context.Context, params Params) (any, error)

ArchiveCommentsSearch calls the reddit-archive-comments-search operation.

func (*Client) ArchiveCommentsTree added in v0.3.0

func (c *Client) ArchiveCommentsTree(ctx context.Context, params Params) (any, error)

ArchiveCommentsTree calls the reddit-archive-comments-tree operation.

func (*Client) ArchivePostsIds added in v0.3.0

func (c *Client) ArchivePostsIds(ctx context.Context, params Params) (any, error)

ArchivePostsIds calls the reddit-archive-posts-ids operation.

func (*Client) ArchivePostsSearch added in v0.3.0

func (c *Client) ArchivePostsSearch(ctx context.Context, params Params) (any, error)

ArchivePostsSearch calls the reddit-archive-posts-search operation.

func (*Client) ArchiveSubredditsSearch added in v0.3.0

func (c *Client) ArchiveSubredditsSearch(ctx context.Context, params Params) (any, error)

ArchiveSubredditsSearch calls the reddit-archive-subreddits-search operation.

func (*Client) ArchiveTimeSeries added in v0.3.0

func (c *Client) ArchiveTimeSeries(ctx context.Context, params Params) (any, error)

ArchiveTimeSeries calls the reddit-archive-time-series operation.

func (*Client) Call

func (c *Client) Call(ctx context.Context, operationID string, params Params) (any, error)

Call executes a selected platform operation by operation ID.

Example
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
	w.Header().Set("Content-Type", "application/json")
	_, _ = w.Write([]byte(`{"ok":true}`))
}))
defer server.Close()

client := NewClient("your-crawlora-api-key")
client.BaseURL = server.URL + "/api/v1"
client.HTTPClient = server.Client()
result, err := client.Call(context.Background(), "reddit-archive-comments-ids", Params{"ids": "sample"})
if err != nil {
	panic(err)
}
fmt.Println(result.(map[string]any)["ok"])
Output:
true

func (*Client) Close

func (c *Client) Close() error

Close releases idle connections held by the configured HTTP transport.

func (*Client) Comment added in v0.3.0

func (c *Client) Comment(ctx context.Context, params Params) (any, error)

Comment calls the reddit-comment operation.

func (*Client) CommentAwards added in v0.3.0

func (c *Client) CommentAwards(ctx context.Context, params Params) (any, error)

CommentAwards calls the reddit-comment-awards operation.

func (*Client) Comments

func (c *Client) Comments(ctx context.Context, params Params) (any, error)

Comments calls the reddit-comments operation.

func (*Client) DomainPosts

func (c *Client) DomainPosts(ctx context.Context, params Params) (any, error)

DomainPosts calls the reddit-domain-posts operation.

func (*Client) Leads

func (c *Client) Leads(ctx context.Context, params Params) (any, error)

Leads calls the reddit-leads operation.

func (*Client) Popular added in v0.3.0

func (c *Client) Popular(ctx context.Context, params Params) (any, error)

Popular calls the reddit-popular operation.

func (*Client) Post

func (c *Client) Post(ctx context.Context, params Params) (any, error)

Post calls the reddit-post operation.

func (*Client) PostAwards added in v0.3.0

func (c *Client) PostAwards(ctx context.Context, params Params) (any, error)

PostAwards calls the reddit-post-awards operation.

func (*Client) PostsByIds added in v0.3.0

func (c *Client) PostsByIds(ctx context.Context, params Params) (any, error)

PostsByIds calls the reddit-posts-by-ids operation.

func (*Client) Search

func (c *Client) Search(ctx context.Context, params Params) (any, error)

Search calls the reddit-search operation.

func (*Client) SearchComments added in v0.3.0

func (c *Client) SearchComments(ctx context.Context, params Params) (any, error)

SearchComments calls the reddit-search-comments operation.

func (*Client) SearchPeople added in v0.3.0

func (c *Client) SearchPeople(ctx context.Context, params Params) (any, error)

SearchPeople calls the reddit-search-people operation.

func (*Client) SubredditAbout

func (c *Client) SubredditAbout(ctx context.Context, params Params) (any, error)

SubredditAbout calls the reddit-subreddit-about operation.

func (*Client) SubredditComments

func (c *Client) SubredditComments(ctx context.Context, params Params) (any, error)

SubredditComments calls the reddit-subreddit-comments operation.

func (*Client) SubredditFlairs added in v0.3.0

func (c *Client) SubredditFlairs(ctx context.Context, params Params) (any, error)

SubredditFlairs calls the reddit-subreddit-flairs operation.

func (*Client) SubredditHighlights added in v0.3.0

func (c *Client) SubredditHighlights(ctx context.Context, params Params) (any, error)

SubredditHighlights calls the reddit-subreddit-highlights operation.

func (*Client) SubredditLeaderboardCategories added in v0.3.0

func (c *Client) SubredditLeaderboardCategories(ctx context.Context, params Params) (any, error)

SubredditLeaderboardCategories calls the reddit-subreddit-leaderboard-categories operation.

func (*Client) SubredditPosts

func (c *Client) SubredditPosts(ctx context.Context, params Params) (any, error)

SubredditPosts calls the reddit-subreddit-posts operation.

func (*Client) SubredditRules added in v0.3.0

func (c *Client) SubredditRules(ctx context.Context, params Params) (any, error)

SubredditRules calls the reddit-subreddit-rules operation.

func (*Client) SubredditUserFlairs added in v0.3.0

func (c *Client) SubredditUserFlairs(ctx context.Context, params Params) (any, error)

SubredditUserFlairs calls the reddit-subreddit-user-flairs operation.

func (*Client) SubredditWiki added in v0.3.0

func (c *Client) SubredditWiki(ctx context.Context, params Params) (any, error)

SubredditWiki calls the reddit-subreddit-wiki operation.

func (*Client) SubredditsDiscover added in v0.3.0

func (c *Client) SubredditsDiscover(ctx context.Context, params Params) (any, error)

SubredditsDiscover calls the reddit-subreddits-discover operation.

func (*Client) SubredditsPosts

func (c *Client) SubredditsPosts(ctx context.Context, params Params) (any, error)

SubredditsPosts calls the reddit-subreddits-posts operation.

func (*Client) SubredditsSearch added in v0.3.0

func (c *Client) SubredditsSearch(ctx context.Context, params Params) (any, error)

SubredditsSearch calls the reddit-subreddits-search operation.

func (*Client) SubredditsSuggest added in v0.3.0

func (c *Client) SubredditsSuggest(ctx context.Context, params Params) (any, error)

SubredditsSuggest calls the reddit-subreddits-suggest operation.

func (*Client) Topics added in v0.3.0

func (c *Client) Topics(ctx context.Context, params Params) (any, error)

Topics calls the reddit-topics operation.

func (*Client) TopicsBroad added in v0.3.0

func (c *Client) TopicsBroad(ctx context.Context, params Params) (any, error)

TopicsBroad calls the reddit-topics-broad operation.

func (*Client) TopicsSearch added in v0.3.0

func (c *Client) TopicsSearch(ctx context.Context, params Params) (any, error)

TopicsSearch calls the reddit-topics-search operation.

func (*Client) Trends

func (c *Client) Trends(ctx context.Context, params Params) (any, error)

Trends calls the reddit-trends operation.

func (*Client) UserComments

func (c *Client) UserComments(ctx context.Context, params Params) (any, error)

UserComments calls the reddit-user-comments operation.

func (*Client) UserPosts

func (c *Client) UserPosts(ctx context.Context, params Params) (any, error)

UserPosts calls the reddit-user-posts operation.

func (*Client) UserProfile added in v0.3.0

func (c *Client) UserProfile(ctx context.Context, params Params) (any, error)

UserProfile calls the reddit-user-profile operation.

type Params

type Params map[string]any

Params maps the exact OpenAPI parameter names expected by this platform client.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL