twitter

package
v0.0.0-...-e7cb044 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2021 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UserFirstTweetDate

func UserFirstTweetDate() time.Time

UserFirstTweetDate returns the date of the user first tweet.

Types

type ArchiveResponse

type ArchiveResponse []struct {
	Source             string  `json:"source"`
	IDStr              string  `json:"id_str"`
	Text               string  `json:"text"`
	CreatedAt          string  `json:"created_at"`
	RetweetCount       int64   `json:"retweet_count"`
	InReplyToUserIDStr *string `json:"in_reply_to_user_id_str"`
	FavoriteCount      int64   `json:"favorite_count"`
	IsRetweet          bool    `json:"is_retweet"`
}

type Collector

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

Collector represents a collector of tweets.

func NewCollector

func NewCollector(config Config, logger *zap.Logger) *Collector

NewCollector returns new collector.

func (*Collector) CollectOverTime

func (col *Collector) CollectOverTime(ctx context.Context) MessageStream

CollectOverTime collects tweets over time.

func (*Collector) CollectTweets

func (col *Collector) CollectTweets() (ArchiveResponse, error)

CollectTweets collects and returns tweets.

type Config

type Config struct {
	// CollectPastYearsTweets will make the collector to collect past year tweets too.
	CollectPastYearsTweets bool
	CollectingInterval     time.Duration
}

Config represents collector configuration.

func (Config) Validate

func (cfg Config) Validate() error

type Message

type Message struct {
	Err    error
	Tweets ArchiveResponse
}

type MessageStream

type MessageStream chan Message

Jump to

Keyboard shortcuts

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