Help us shape the future of Go! Take the 2026 Go Developer Survey

reddit

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2026 License: MIT Imports: 12 Imported by: 0

README

Reddit clients for Crawlora

Official Crawlora client packages for the hosted Reddit API. Access 12 API endpoints covering search, post and comment details, subreddit feeds, user history, domain listings, trends, and leads from JavaScript/TypeScript, Python, Go, Ruby, Java, and PHP. 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 six language clients provide access to all 12 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/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/post/{id} reddit-post Get Reddit post
GET /reddit/search reddit-search Search Reddit posts
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}/posts reddit-subreddit-posts List Reddit subreddit posts
GET /reddit/subreddits/posts reddit-subreddits-posts List Reddit multi-subreddit posts
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

License

MIT. See LICENSE.

Documentation

Overview

Package reddit is Crawlora's Reddit API client for 12 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.2.0"
)
View Source
const OperationCount = 12

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) 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-comments", Params{"id": "sample-id"})
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) 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) Post

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

Post calls the reddit-post operation.

func (*Client) Search

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

Search calls the reddit-search 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) SubredditPosts

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

SubredditPosts calls the reddit-subreddit-posts operation.

func (*Client) SubredditsPosts

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

SubredditsPosts calls the reddit-subreddits-posts 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.

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