pushshift

package
v0.0.0-...-e021242 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// HTTPTimeout is the timeout in seconds for the HTTP client
	HTTPTimeout int = 5
	// SortAsc is a helper constant to sort ascending
	SortAsc string = "asc"
	// SortDesc is a helper constant to sort ascending
	SortDesc string = "desc"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is the base pushshift HTTP client

func NewClient

func NewClient(userAgent string) *Client

NewClient creates a new client

func NewClientWithProxy

func NewClientWithProxy(userAgent string, proxyURL string) (*Client, error)

NewClientWithProxy creates a new client that uses a proxy

func (*Client) GetComments

func (c *Client) GetComments(q *CommentQuery) ([]Comment, error)

GetComments queries the API for comments

func (*Client) GetSubmissions

func (c *Client) GetSubmissions(q *SubmissionQuery) ([]Submission, error)

GetSubmissions queries the API for submissions

func (*Client) StreamComments

func (c *Client) StreamComments(q *FirehoseQuery) chan *Comment

func (*Client) StreamFirehose

func (c *Client) StreamFirehose(q *FirehoseQuery) chan interface{}

func (*Client) StreamSubmissions

func (c *Client) StreamSubmissions(q *FirehoseQuery) chan *Submission

type Comment

type Comment struct {
	AllAwardings               []interface{}   `json:"all_awardings"`
	ApprovedAtUtc              interface{}     `json:"approved_at_utc"`
	Author                     string          `json:"author"`
	AuthorFlairBackgroundColor interface{}     `json:"author_flair_background_color"`
	AuthorFlairCSSClass        interface{}     `json:"author_flair_css_class"`
	AuthorFlairRichtext        []interface{}   `json:"author_flair_richtext"`
	AuthorFlairTemplateID      interface{}     `json:"author_flair_template_id"`
	AuthorFlairText            interface{}     `json:"author_flair_text"`
	AuthorFlairTextColor       interface{}     `json:"author_flair_text_color"`
	AuthorFlairType            string          `json:"author_flair_type"`
	AuthorFullname             string          `json:"author_fullname"`
	AuthorPatreonFlair         bool            `json:"author_patreon_flair"`
	BannedAtUtc                interface{}     `json:"banned_at_utc"`
	Body                       string          `json:"body"`
	CanModPost                 bool            `json:"can_mod_post"`
	Collapsed                  bool            `json:"collapsed"`
	CollapsedReason            interface{}     `json:"collapsed_reason"`
	CreatedUtc                 int             `json:"created_utc"`
	Distinguished              interface{}     `json:"distinguished"`
	Edited                     bool            `json:"edited"`
	Gildings                   CommentGildings `json:"gildings"`
	ID                         string          `json:"id"`
	IsSubmitter                bool            `json:"is_submitter"`
	LinkID                     string          `json:"link_id"`
	Locked                     bool            `json:"locked"`
	NoFollow                   bool            `json:"no_follow"`
	ParentID                   string          `json:"parent_id"`
	Permalink                  string          `json:"permalink"`
	RetrievedOn                int             `json:"retrieved_on"`
	Score                      int             `json:"score"`
	SendReplies                bool            `json:"send_replies"`
	Stickied                   bool            `json:"stickied"`
	Subreddit                  string          `json:"subreddit"`
	SubredditID                string          `json:"subreddit_id"`
	TotalAwardsReceived        int             `json:"total_awards_received"`
}

Comment is a holder for comment data

type CommentGildings

type CommentGildings struct{}

CommentGildings is a placeholder for gilded comments

type CommentQuery

type CommentQuery struct {
	Sort                string `url:"sort,omitempty" json:"sort,omitempty"`
	SortType            string `url:"sort_type,omitempty" json:"sort_type,omitempty"`
	After               int    `url:"after,omitempty" json:"after,omitempty"`
	Before              int    `url:"before,omitempty" json:"before,omitempty"`
	AfterID             int    `url:"after_id,omitempty" json:"after_id,omitempty"`
	BeforeID            int    `url:"before_id,omitempty" json:"before_id,omitempty"`
	CreatedUTC          int    `url:"created_utc,omitempty" json:"created_utc,omitempty"`
	Score               int    `url:"score,omitempty" json:"score,omitempty"`
	Gilded              int    `url:"gilded,omitempty" json:"gilded,omitempty"`
	Edited              bool   `url:"edited,omitempty" json:"edited,omitempty"`
	Author              string `url:"author,omitempty" json:"author,omitempty"`
	Subreddit           string `url:"subreddit,omitempty" json:"subreddit,omitempty"`
	Distinguished       string `url:"distinguished,omitempty" json:"distinguished,omitempty"`
	RetrievedOn         int    `url:"retrieved_on,omitempty" json:"retrieved_on,omitempty"`
	LastUpdated         int    `url:"last_updated,omitempty" json:"last_updated,omitempty"`
	Query               string `url:"q,omitempty" json:"q,omitempty"`
	ID                  int    `url:"id,omitempty" json:"id,omitempty"`
	Metadata            bool   `url:"metadata,omitempty" json:"metadata,omitempty"`
	Unique              string `url:"unique,omitempty" json:"unique,omitempty"`
	Pretty              bool   `url:"pretty,omitempty" json:"pretty,omitempty"`
	HTMLDecode          bool   `url:"html_decode,omitempty" json:"html_decode,omitempty"`
	Permalink           string `url:"permalink,omitempty" json:"permalink,omitempty"`
	IsUserRemoved       bool   `url:"user_removed,omitempty" json:"user_removed,omitempty"`
	IsModRemoved        bool   `url:"mod_removed,omitempty" json:"mod_removed,omitempty"`
	SubredditType       string `url:"subreddit_type,omitempty" json:"subreddit_type,omitempty"`
	AuthorFlairCSSClass string `url:"author_flair_css_class,omitempty" json:"author_flair_css_class,omitempty"`
	AuthorFlairText     string `url:"author_flair_text,omitempty" json:"author_flair_text,omitempty"`
	ReplyDelay          int    `url:"reply_delay,omitempty" json:"reply_delay,omitempty"`
	NestLevel           int    `url:"nest_level,omitempty" json:"nest_level,omitempty"`
	SubReplyDelay       int    `url:"sub_reply_delay,omitempty" json:"sub_reply_delay,omitempty"`
	UTCHourOfWeek       int    `url:"utc_hour_of_week,omitempty" json:"utc_hour_of_week,omitempty"`
	LinkID              int    `url:"link_id,omitempty" json:"link_id,omitempty"`
	ParentID            int    `url:"parent_id,omitempty" json:"parent_id,omitempty"`
}

CommentQuery is the query for comments

type FirehoseQuery

type FirehoseQuery struct {
	Type               string `url:"type,omitempty"`
	Author             string `url:"author,omitempty"`
	Domain             string `url:"domain,omitempty"`
	Subreddit          string `url:"subreddit,omitempty"`
	SubmissionBackfill int    `url:"submission_backfill,omitempty"`
	CommentBackfill    int    `url:"comment_backfill,omitempty"`
	SubmissionStartID  int    `url:"submission_start_id,omitempty"`
	CommentStartID     int    `url:"comment_start_id,omitempty"`
	IsOver18           bool   `url:"over_18,omitempty"`
	IsSelf             bool   `url:"is_self,omitempty"`
	Filter             string `url:"filter,omitempty"`
}

type Images

type Images struct {
	ID          string        `json:"id"`
	Resolutions []Resolutions `json:"resolutions"`
	Source      Source        `json:"source"`
	Variants    Variants      `json:"variants"`
}

type Preview

type Preview struct {
	Enabled bool     `json:"enabled"`
	Images  []Images `json:"images"`
}

type Resolutions

type Resolutions struct {
	Height int    `json:"height"`
	URL    string `json:"url"`
	Width  int    `json:"width"`
}

type Source

type Source struct {
	Height int    `json:"height"`
	URL    string `json:"url"`
	Width  int    `json:"width"`
}

type Submission

type Submission struct {
	AllAwardings               []interface{}      `json:"all_awardings"`
	AllowLiveComments          bool               `json:"allow_live_comments"`
	Author                     string             `json:"author"`
	AuthorFlairCSSClass        interface{}        `json:"author_flair_css_class"`
	AuthorFlairRichtext        []interface{}      `json:"author_flair_richtext"`
	AuthorFlairText            interface{}        `json:"author_flair_text"`
	AuthorFlairType            string             `json:"author_flair_type"`
	AuthorFullname             string             `json:"author_fullname"`
	AuthorPatreonFlair         bool               `json:"author_patreon_flair"`
	CanModPost                 bool               `json:"can_mod_post"`
	ContestMode                bool               `json:"contest_mode"`
	CreatedUtc                 int                `json:"created_utc"`
	Domain                     string             `json:"domain"`
	FullLink                   string             `json:"full_link"`
	Gildings                   SubmissionGildings `json:"gildings"`
	ID                         string             `json:"id"`
	IsCrosspostable            bool               `json:"is_crosspostable"`
	IsMeta                     bool               `json:"is_meta"`
	IsOriginalContent          bool               `json:"is_original_content"`
	IsRedditMediaDomain        bool               `json:"is_reddit_media_domain"`
	IsRobotIndexable           bool               `json:"is_robot_indexable"`
	IsSelf                     bool               `json:"is_self"`
	IsVideo                    bool               `json:"is_video"`
	LinkFlairBackgroundColor   string             `json:"link_flair_background_color"`
	LinkFlairRichtext          []interface{}      `json:"link_flair_richtext"`
	LinkFlairTextColor         string             `json:"link_flair_text_color"`
	LinkFlairType              string             `json:"link_flair_type"`
	Locked                     bool               `json:"locked"`
	MediaOnly                  bool               `json:"media_only"`
	NoFollow                   bool               `json:"no_follow"`
	NumComments                int                `json:"num_comments"`
	NumCrossposts              int                `json:"num_crossposts"`
	Over18                     bool               `json:"over_18"`
	Permalink                  string             `json:"permalink"`
	Pinned                     bool               `json:"pinned"`
	RetrievedOn                int                `json:"retrieved_on"`
	Score                      int                `json:"score"`
	Selftext                   string             `json:"selftext"`
	SendReplies                bool               `json:"send_replies"`
	Spoiler                    bool               `json:"spoiler"`
	Stickied                   bool               `json:"stickied"`
	Subreddit                  string             `json:"subreddit"`
	SubredditID                string             `json:"subreddit_id"`
	SubredditSubscribers       int                `json:"subreddit_subscribers"`
	SubredditType              string             `json:"subreddit_type"`
	Thumbnail                  string             `json:"thumbnail"`
	Title                      string             `json:"title"`
	TotalAwardsReceived        int                `json:"total_awards_received"`
	URL                        string             `json:"url"`
	ParentWhitelistStatus      string             `json:"parent_whitelist_status,omitempty"`
	Pwls                       int                `json:"pwls,omitempty"`
	WhitelistStatus            string             `json:"whitelist_status,omitempty"`
	Wls                        int                `json:"wls,omitempty"`
	PostHint                   string             `json:"post_hint,omitempty"`
	Preview                    Preview            `json:"preview,omitempty"`
	SuggestedSort              string             `json:"suggested_sort,omitempty"`
	ThumbnailHeight            int                `json:"thumbnail_height,omitempty"`
	ThumbnailWidth             int                `json:"thumbnail_width,omitempty"`
	LinkFlairCSSClass          string             `json:"link_flair_css_class,omitempty"`
	LinkFlairTemplateID        string             `json:"link_flair_template_id,omitempty"`
	LinkFlairText              string             `json:"link_flair_text,omitempty"`
	AuthorFlairBackgroundColor string             `json:"author_flair_background_color,omitempty"`
	AuthorFlairTextColor       string             `json:"author_flair_text_color,omitempty"`
	ContentCategories          []string           `json:"content_categories,omitempty"`
}

type SubmissionGildings

type SubmissionGildings struct {
}

type SubmissionQuery

type SubmissionQuery struct {
	Sort                string `url:"sort,omitempty" json:"sort,omitempty"`
	SortType            string `url:"sort_type,omitempty" json:"sort_type,omitempty"`
	After               int    `url:"after,omitempty" json:"after,omitempty"`
	Before              int    `url:"before,omitempty" json:"before,omitempty"`
	AfterID             int    `url:"after_id,omitempty" json:"after_id,omitempty"`
	BeforeID            int    `url:"before_id,omitempty" json:"before_id,omitempty"`
	CreatedUTC          int    `url:"created_utc,omitempty" json:"created_utc,omitempty"`
	Score               int    `url:"score,omitempty" json:"score,omitempty"`
	Gilded              int    `url:"gilded,omitempty" json:"gilded,omitempty"`
	Edited              bool   `url:"edited,omitempty" json:"edited,omitempty"`
	Author              string `url:"author,omitempty" json:"author,omitempty"`
	Subreddit           string `url:"subreddit,omitempty" json:"subreddit,omitempty"`
	Distinguished       string `url:"distinguished,omitempty" json:"distinguished,omitempty"`
	RetrievedOn         int    `url:"retrieved_on,omitempty" json:"retrieved_on,omitempty"`
	LastUpdated         int    `url:"last_updated,omitempty" json:"last_updated,omitempty"`
	Query               string `url:"q,omitempty" json:"q,omitempty"`
	ID                  int    `url:"id,omitempty" json:"id,omitempty"`
	Metadata            bool   `url:"metadata,omitempty" json:"metadata,omitempty"`
	Unique              string `url:"unique,omitempty" json:"unique,omitempty"`
	Pretty              bool   `url:"pretty,omitempty" json:"pretty,omitempty"`
	HTMLDecode          bool   `url:"html_decode,omitempty" json:"html_decode,omitempty"`
	Permalink           string `url:"permalink,omitempty" json:"permalink,omitempty"`
	IsUserRemoved       bool   `url:"user_removed,omitempty" json:"user_removed,omitempty"`
	IsModRemoved        bool   `url:"mod_removed,omitempty" json:"mod_removed,omitempty"`
	Size                int    `url:"size,omitempty" json:"size,omitempty"`
	SubredditType       string `url:"subreddit_type,omitempty" json:"subreddit_type,omitempty"`
	AuthorFlairCSSClass string `url:"author_flair_css_class,omitempty" json:"author_flair_css_class,omitempty"`
	AuthorFlairText     string `url:"author_flair_text,omitempty" json:"author_flair_text,omitempty"`

	IsOver18          bool `url:"over_18,omitempty" json:"over_18,omitempty"`
	IsLocked          bool `url:"author_flair_text,omitempty" json:"author_flair_text,omitempty"`
	IsSpoiler         bool `url:"author_flair_text,omitempty" json:"author_flair_text,omitempty"`
	IsVideo           bool `url:"author_flair_text,omitempty" json:"author_flair_text,omitempty"`
	IsSelf            bool `url:"author_flair_text,omitempty" json:"author_flair_text,omitempty"`
	IsOriginalContent bool `url:"author_flair_text,omitempty" json:"author_flair_text,omitempty"`
	// contains filtered or unexported fields
}

SubmissionQuery is a query

type Variants

type Variants struct {
}

Jump to

Keyboard shortcuts

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