Skip to content

Instantly share code, notes, and snippets.

@zpao
Created June 29, 2010 19:41
Show Gist options
  • Save zpao/457704 to your computer and use it in GitHub Desktop.
Save zpao/457704 to your computer and use it in GitHub Desktop.
var latestTweetRequest = Request({
url: "http://api.twitter.com/1/statuses/public_timeline.json",
onComplete: function () {
var tweet = this.response.json[0];
console.log("User: " + tweet.user.screen_name);
console.log("Tweet: " + tweet.text);
}
});
// Be a good consumer and check for rate limiting before doing more.
Request({
url: "http://api.twitter.com/1/account/rate_limit_status.json",
onComplete: function () {
if (this.response.json.remaining_hits) {
latestTweetRequest.get();
} else {
console.log("You have been rate limited!");
}
}
}).get();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment