Search code examples
jqueryrssjfeed

Trying to get content:encoded with jfeed


I can get a successful response with the RSS I am trying to pull using jfeed, however, the thing I really want is the content. [content:encoded] I need this so I can grab the first image from each post.

I figured it would be easy to update jfeed to do this, but nothing I try seems to get it. The most obvious attempt was to add:

item.content = jQuery(this).find('content\:encoded').eq(0).text();

but this returns an empty string. I'd really appreciate a push in the right direction, thanks all!


Solution

  • Caveat: Don't know jfeed, but I've used lots of feed parsers.

    With that caveat, why do you prefix the colon with a slash? You should not need to do that.

    Also, some feed parsers are not namespace aware. Since content is a namespace prefix, it's possible that jfeed is not able to find() on that. In that case, you would need to try .find('encoded'), omitting the namespace prefix.

    It's also possible that that feed (or certain items in that feed) don't have the content:encoded element. That's an extension of RSS and not a required element.