mediagroup.mediacontent from rss not loading using AJAX/Google Feed API
Hi Guys, I've been banging my head on this topic and i still haven't found a solution to my issue. I know there are many questions answered about how to load media$group.media$content.url but I can't seem to get any of those solutions to work for my code.
I'm parsing my feed using zRSSfeed. I can't seem to load the mediagroup node and its contents. specifically the content url and the thumbnail url attributes. Here is a snippet of the code that is loading the title of the feed article. I want to replace the "entry.link" with the media:group->content url. How will I be able to accomplish this? I really need to finish this as I have a deadline and I I'm stuck for three days now.
The following is the full set of code from the zrssfeed.js file.
- (function($){
var current = null;
$.fn.rssfeed = function(url, options) {
// Set pluign defaults
var defaults = {
limit: 10,
header: true,
titletag: 'h4',
date: true,
content: true,
snippet: true,
showerror: true,
errormsg: '',
key: null
};
var options = $.extend(defaults, options);
// Functions
return this.each(function(i, e) {
var $e = $(e);
// Add feed class to user div
if (!$e.hasClass('rssFeed')) $e.addClass('rssFeed');
// Check for valid url
if(url == null) return false;
// Create Google Feed API address
var api = "http://ajax.googleapis.com/ajax/services/feed/load?v=2.0&callback=?&q=" + url;
if (options.limit != null) api += "&num=" + options.limit;
if (options.key != null) api += "&key=" + options.key;
// Send request
$.getJSON(api, function(data){
// Check for error
if (data.responseStatus == 200) {
// Process the feeds
_callback(e, data.responseData.feed, options);
} else {
// Handle error if required
if (options.showerror)
if (options.errormsg != '') {
var msg = options.errormsg;
} else {
var msg = data.responseDetails;
};
$(e).html('<div class="rssError"><p>'+ msg +'</p></div>');
};
});
});
};
// Callback function to create HTML result
var _callback = function(e, feeds, options) {
if (!feeds) {
return false;
}
var html = '';
var row = 'odd';
// Add header if required
if (options.header)
html += '<div class="rssHeader">' +
'<a href="'+feeds.link+'" title="'+ feeds.description +'">'+ feeds.title +'</a>' +
'</div>';
// Add body
html += '<div class="rssBody">' +
'<ul>';
// Add feeds
for (var i=0; i<feeds.entries.length; i++) {
// Get individual feed
var entry = feeds.entries[i];
// Format published date
var entryDate = new Date(entry.publishedDate);
var pubDate = entryDate.toLocaleDateString() + ' ' + entryDate.toLocaleTimeString();
// Add feed row
html += '<li class="rssRow '+row+'">' +
'<'+ options.titletag +'><a href="'+ entry.link +'" title="View this feed at '+ feeds.title +'">'+ entry.title +'</a></'+ options.titletag +'>'
if (options.date) html += '<div>'+ pubDate +'</div>'
if (options.content) {
// Use feed snippet if available and optioned
if (options.snippet && entry.contentSnippet != '') {
var content = entry.contentSnippet;
} else {
var content = entry.content;
}
html += '<p>'+ content +'</p>'
}
html += '</li>';
// Alternate row classes
if (row == 'odd') {
row = 'even';
} else {
row = 'odd';
}
}
html += '</ul>' +
'</div>'
$(e).html(html);
};
})(jQuery);
The following is the specific line concerned with this issue. I want to be able to change "entry.link" to the "media:group content url". Also, I have tried using entry.media$group.media$content[0].url and media$group.media$content.attr('url') with no luck. Please help me!!!
<'+options.titletag+'><a href="'+ entry.link+'" title="View this feed at '+feeds.title+'">'+entry.title+'</a></'+options.titletag+'>'