myatia
Programmer
- Nov 21, 2002
- 232
I'm using jQuery to display a Twitter feed on my website. I would like to be able to parse out the user's profile image, which is passed in a "media:content" or "google:image" elements. I've tried things like this:
author = $('item', xml).find('google:image').eq(0).text();
author = $('item', xml).find('media:content').href;
I'm just not sure what the exact syntax is. Any help would be appreciated. My code and RSS feed are below. Thanks!
The RSS feed from Twitter looks like this:
author = $('item', xml).find('google:image').eq(0).text();
author = $('item', xml).find('media:content').href;
I'm just not sure what the exact syntax is. Any help would be appreciated. My code and RSS feed are below. Thanks!
Code:
$(document).ready(function(){
$.get("/includes/twitter-functions.asp", {a:'xml', user:'mbac09', list:'keyword'}, function(xml){
// Build an HTML string
var myHTMLOutput = '';
var s = '';
var i;
var ci;
var description;
for (i=0; i<15; i++) {
ci = $('item', xml).eq(i);
description = ci.find('title').eq(0).text();
// description = getTwitterDisplay(description);
myHTMLOutput = myHTMLOutput + '<p>' + author + ': ' + description + "<br /><small><em>" + pubDate + "</em></small></p>";
}
// Update the DIV called Content Area with the HTML string
$("#Twitter").append(myHTMLOutput);
});
});
The RSS feed from Twitter looks like this:
Code:
<item>
<title>RT @bschaaf Great tool used by Tommy Stephens at #MBAC09 - Virtual Magnifying Glass. Plan to use it in my class [URL unfurl="true"]http://tinyurl.com/lsmkdu</title>[/URL]
<link>[URL unfurl="true"]http://twitter.com/lwedul/statuses/2309366447</link>[/URL]
<description>RT <a href="[URL unfurl="true"]http://twitter.com/bschaaf">@bschaaf</a>[/URL] Great tool used by Tommy Stephens at <a href="[URL unfurl="true"]http://search.twitter.com/search?q=%23MBAC09">#<b>MBAC09</b></a>[/URL] - Virtual Magnifying Glass. Plan to use it in my class <a href="[URL unfurl="true"]http://tinyurl.com/lsmkdu">http://tinyurl.com/lsmkdu</a></description>[/URL]
<pubDate>Wed, 24 Jun 2009 12:00:09 +0000</pubDate>
<guid>[URL unfurl="true"]http://twitter.com/lwedul/statuses/2309366447</guid>[/URL]
<author>lwedul@twitter.com (Linda Wedul)</author>
<media:content type="image/jpg" url="[URL unfurl="true"]http://s3.amazonaws.com/twitter_production/profile_images/276827204/linda_opt_normal.jpg"[/URL] width="48" height="48"/>
<google:image_link>[URL unfurl="true"]http://s3.amazonaws.com/twitter_production/profile_images/276827204/linda_opt_normal.jpg</google:image_link>[/URL]
</item>