Skip to content

Instantly share code, notes, and snippets.

@UnquietCode
Created September 13, 2012 02:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save UnquietCode/3711511 to your computer and use it in GitHub Desktop.
Save UnquietCode/3711511 to your computer and use it in GitHub Desktop.
Extract tweet info from the basic Twitter timeline widget.
<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