0

I am trying to get the media:title element from a youtube user's feed using jquery's get json method. I can get a number of the other nodes successfully, but I can't get the media title. Here's the feed url:

http://gdata.youtube.com/feeds/users/armaniexchange/uploads?alt=json-in-script&format=5&callback=showMyVideos

And here's the code I'm using:

<script type="text/javascript">
$(document).ready(function() {
$.getJSON('http://gdata.youtube.com/feeds/users/armaniexchange/uploads?alt=json-in-script&callback=?&max-results=2', function(data) { 
        $.each(data.feed.entry, function(i, item) {
                var updated = item.updated;
                var url = item['media$group']['media$content'][0]['url'];
                var thumb = item['media$group']['media$thumbnail'][0]['url'];
        var media_title = item['media$group']['media$title'];
                var numViews = item['yt$statistics']['viewCount'];

        //$('#feed_container').append('<div class="thumb"><a href="javascript:void(0);" data-link="' + url + '">' + media_title + '</a></div>');

                alert([url, thumb, numViews,media_title].join('\n')); // display it
        });



});
});

2
  • Tip: accept some answers. Both of your previous questions received at least one working solution. Commented Jan 21, 2011 at 15:49
  • Agreed, please accept my answer if it works for you, thank you... and an upvote doesn't hurt either. ;) Commented Jan 21, 2011 at 15:52

1 Answer 1

2

In your code, media_title is an object that contains the properties $t with the title you want and another property type with a purpose unknown to me.

I've created a fiddle here to call media_title.$t to show the title you want.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.