Created
September 13, 2012 02:46
-
-
Save UnquietCode/3711511 to your computer and use it in GitHub Desktop.
Extract tweet info from the basic Twitter timeline widget.
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> | |
<head> | |
<script type="text/javascript" src="jquery-1.8.1.min.js"></script> | |
<script type="text/javascript"> | |
<!-- use the url that your twitter widget is using to retrieve the tweet data --> | |
$(function() { | |
$.getJSON("http://cdn.syndication.twimg.com/widgets/timelines/246079887021051904?dnt=true&domain=unquietcode.com&lang=en&callback=?", function(data) { | |
var tweets = $(data.body).find('li.tweet'); | |
Tweets = []; | |
for (var i=0; i < tweets.length; ++i) { | |
var cur = $(tweets[i]); | |
var tweet = {}; | |
tweet.authorFullName = cur.find("span.full-name span.p-name").html(); | |
tweet.authorUserName = cur.find("span.p-nickname b").html(); | |
tweet.date = cur.find("a.u-url").attr("data-datetime"); | |
tweet.id = cur.attr("data-tweet-id"); | |
tweet.text = $.trim(cur.find("p.e-entry-title").html()); | |
Tweets.push(tweet); | |
} | |
}); | |
}); | |
</script> | |
</head> | |
<body> | |
<div>Hi mom!</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment