×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

parsing out profile image in Twitter RSS feed (media:content)

parsing out profile image in Twitter RSS feed (media:content)

parsing out profile image in Twitter RSS feed (media:content)

(OP)
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!

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 http://tinyurl.com/lsmkdu</title>

      <link>http://twitter.com/lwedul/statuses/2309366447</link>
      <description>RT &lt;a href="http://twitter.com/bschaaf"&gt;@bschaaf&lt;/a&gt; Great tool used by Tommy Stephens at &lt;a href="http://search.twitter.com/search?q=%23MBAC09"&gt;#&lt;b&gt;MBAC09&lt;/b&gt;&lt;/a&gt; - Virtual Magnifying Glass. Plan to use it in my class &lt;a href="http://tinyurl.com/lsmkdu"&gt;http://tinyurl.com/lsmkdu&lt;/a&gt;</description>

      <pubDate>Wed, 24 Jun 2009 12:00:09 +0000</pubDate>
      <guid>http://twitter.com/lwedul/statuses/2309366447</guid>
      <author>lwedul@twitter.com (Linda Wedul)</author>
      <media:content type="image/jpg" url="http://s3.amazonaws.com/twitter_production/profile_images/276827204/linda_opt_normal.jpg" width="48" height="48"/>
      <google:image_link>http://s3.amazonaws.com/twitter_production/profile_images/276827204/linda_opt_normal.jpg</google:image_link>
    </item>
Replies continue below

Recommended for you

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close