Edit in JSFiddle

if (p.publisher == 'instagram.com') {
    social_title = p.title.split(':');
    social_handle = p.title.split(' ');
    text += '<!-- instagram link --><figure>' + link_image + '<figcaption><p>' + p.excerpt + '<br>&mdash; <a href="' + p.url + '" target="_blank">' + social_title[0] + '</a></p></figcaption></figure>';
} else if (p.publisher == 'twitter.com') {
    social_title = p.title.split(' on ');
    social_handle = p.url.split('/');
    if (p.excerpt != null) {
        var excerpt = p.excerpt.replace(/(https?:\/\/[^\s]+)/g, "");
    }
    text += '<!-- twitter link --><blockquote><p>' + excerpt + '</p><cite>&mdash; <a href="' + p.url + '" target="_blank">' + p.title + '</a></cite></blockquote>';
}