Created
March 21, 2011 10:24
-
-
Save oivoodoo/879261 to your computer and use it in GitHub Desktop.
Retrieve data from twitter and tumblr for my own web site.
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
$(function(){ | |
$.getJSON('http://search.twitter.com/search.json?callback=?&q=oivoodoo&rpp=5', function(data){ | |
var html = ""; | |
for(var i = 0; i < data.results.length; i++) { | |
var tweet = data.results[i]; | |
html += "<div class='tweet'><a href='http://twitter.com/oivoodoo/'>@oivoodoo</a>:<span>" + tweet.text + '</span></div>'; | |
} | |
$('#twitter').html(html); | |
}); | |
$.getJSON('http://oivoodoo.tumblr.com/api/read/json?callback=?', function(data){ | |
var html = ""; | |
var MAX = 5; | |
for(var i = 0; (i < MAX) && data.posts.length > i; i++) { | |
var post = data.posts[i]; | |
if (!!post['regular-title']) { | |
html += "<div class='post'><a href='" + post.url + "'>" + post['regular-title'] + "</a><p>"; | |
if (!!post.tags) { | |
for(var j = 0; j < post.tags.length; j++) { | |
html += "<a class='contact' href='http://oivoodoo.tumblr.com/tagged/" + post.tags[j] + "/chrono'>" + post.tags[j] + "</a>"; | |
} | |
} | |
} else { | |
MAX += 1; | |
} | |
} | |
$('#tumblr').html(html); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment