Skip to content

Instantly share code, notes, and snippets.

@jordanorelli
Created August 8, 2012 00:36
Show Gist options
  • Save jordanorelli/3290943 to your computer and use it in GitHub Desktop.
Save jordanorelli/3290943 to your computer and use it in GitHub Desktop.
twitter stream to stdout
package main
import (
"fmt"
"github.com/jordanorelli/twitter"
"log"
)
var (
consumer_key = ""
consumer_secret = ""
access_token = ""
access_token_secret = ""
)
func main() {
client := twitter.NewClient(consumer_key, consumer_secret)
c, errchan := make(chan *twitter.Tweet), make(chan error)
follows, err := client.UserStream(access_token, access_token_secret, c, errchan)
if err != nil {
log.Fatal(err)
}
fmt.Println(follows)
for {
select {
case tweet := <-c:
fmt.Println(tweet)
case err := <-errchan:
log.Fatal(err)
}
}
}
@jordanorelli
Copy link
Author

I'm not really all that thrilled with this API. It still needs a lot of work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment