twitter

package
v0.0.0-...-24a8c69 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2020 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DonaldTrumpUserName = "realDonaldTrump"
)

Variables

This section is empty.

Functions

func TrumpFirstTweetDate

func TrumpFirstTweetDate() time.Time

TrumpFirstTweetDate returns the date of the first Trump 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"`
}

ArchiveResponse represents the response from http://trumptwitterarchive.com/data/realdonaldtrump/2019.json

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 from http://trumptwitterarchive.com.

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