twitterfeed

package module
v0.0.0-...-ac9dd19 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2017 License: GPL-3.0 Imports: 12 Imported by: 1

README

twitterfeed

Go channel providing live tweets containing search terms.

The following code reads all tweets containing "monkey" for five seconds:

ctx, _ := context.WithTimeout(context.Background(), 5*time.Second)

r := twitterfeed.NewTweetReader("consumerKey", "consumerSecret", "accessToken", "accessSecret")
for tweet := range r.Run(ctx, "monkey") {
	log.Println(tweet)
}

log.Println("done")
  • You can read the GoDocs if you prefer

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Tweet

type Tweet struct {
	// Text is the body of the tweet.
	Text string
	// Terms is a list of matching terms in the text.
	Terms []string
}

Tweet is a single tweet.

type TweetReader

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

TweetReader reads tweets.

func NewTweetReader

func NewTweetReader(consumerKey, consumerSecret, accessToken, accessSecret string) *TweetReader

NewTweetReader creates a new TweetReader with the given credentials.

func (*TweetReader) Run

func (r *TweetReader) Run(ctx context.Context, terms ...string) <-chan Tweet

Run starts reading and returns a channel through which Tweet objects are sent. Use a cancel function or timeout on the context to terminate the reader.

Jump to

Keyboard shortcuts

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