Create a gist now

Instantly share code, notes, and snippets.

Basic tweet parsing via json and jquery
//Tell the function where the feed is located
$.getJSON("", function(data){
//Grab each of the "entries"
$.each(data, function(i,item){
//Create the links and throw them
//into the body of the page
function twitify( text ) {
// replace urls with linked ones
var t2 = text.replace(/(http|https)(:\/\/)([^ )]+)/ig, '<a href="$1$2$3">$1$2$3</a>' );
// replace @username with clickable twitter link
t2 = t2.replace(/@([^ ]+)/gi,'<a href="$1">@$1</a>');
// replace hashtags with Twitter searches
t2 = t2.replace(/#([^ ]+)/gi,'<a href="$1">#$1</a>');
return t2;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment