Created
August 8, 2012 00:36
-
-
Save jordanorelli/3290943 to your computer and use it in GitHub Desktop.
twitter stream to stdout
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm not really all that thrilled with this API. It still needs a lot of work.