Created
March 27, 2013 14:29
-
-
Save felds/5254591 to your computer and use it in GitHub Desktop.
Listando tweets com CoffeeScript
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
| #!/usr/bin/env coffee | |
| http = require 'http' | |
| user = 'felds' | |
| count = 10 | |
| url = "http://api.twitter.com/1/statuses/user_timeline.json?screen_name=#{user}&count=#{count}" | |
| http.get url, (response) -> | |
| buffer = new Buffer 0 | |
| response.on 'data', (data) -> | |
| buffer += data | |
| response.on 'end', -> | |
| tweets = JSON.parse(buffer.toString()) | |
| for tweet in tweets | |
| console.log "#{tweet.user.name} disse:\n#{tweet.text}\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment