Skip to content

Instantly share code, notes, and snippets.

@shuhblam
Created July 23, 2011 16:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shuhblam/1101606 to your computer and use it in GitHub Desktop.
Save shuhblam/1101606 to your computer and use it in GitHub Desktop.
//this is an example twitter call for geolocated tweets
//all you need is a lat lng to get tweets from anywhere
//in the world
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
//only get the first 5 pages
//since we are only interested
//in recent tweets
for (z = 0; z <= 5; z++) {
//ask twitter to give you tweets
var jqxhr = $.getJSON("http://search.twitter.com/search.json?callback=?", {
geocode: '51.499054,-0.133524,1mi',
rpp: "100",
result_type: "recent",
page: z + 1
}, function (data) {
//loop over every tweet and see if it contains geo data
$.each(data.results, function (idx, t) {
//if this tweet has data save it to array tweetlist
if (t.geo) {
tweetList.push(t);
}
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment