Created
August 4, 2009 22:32
-
-
Save choonkeat/162360 to your computer and use it in GitHub Desktop.
Just edit the 2 parameters on line 11 -- search term, and css selector
This file contains 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
<html><body> | |
<script src="http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js"></script> | |
<script> | |
(function(search_term, css_selector) { | |
jQuery.getJSON("http://search.twitter.com/search.json?q=" + encodeURIComponent(search_term) + "&callback=?", function(json) { | |
var tweet_html = []; | |
jQuery.each(json.results, function(index, tweet) { | |
tweet_html.push("<li><img style='height: 48px;' src='" + tweet.profile_image_url + "'/>\n<span class='author'>" + tweet.from_user + "</span>\n<span class='tweet'>" + tweet.text + "</span></li>"); | |
}); | |
jQuery(document.body).append("<ol>" + tweet_html.join("") + "</ol>"); | |
}); | |
})("nba", "html > body"); | |
</script> | |
</body></html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment