尝试获取内容:使用jfeed编码 [英] Trying to get content:encoded with jfeed

查看:98
本文介绍了尝试获取内容:使用jfeed编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用jfeed提取的RSS能够获得成功的响应,但是,我真正想要的是内容. [内容:已编码]我需要这个,这样我就可以从每个帖子中获取第一张图片.

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.

我认为更新jfeed可以很容易地做到这一点,但是我尝试的一切似乎都没有.最明显的尝试是添加:

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!

推荐答案

注意:不了解jfeed,但是我已经使用了很多feed解析器.

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.

此外,某些提要解析器不支持名称空间.由于content是名称空间前缀,因此jfeed可能无法在其上进行find().在这种情况下,您需要尝试.find('encoded'),省略名称空间前缀.

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.

该提要(或该提要中的某些项目)也可能没有content:encoded元素.那是RSS的扩展,不是必需的元素.

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.

这篇关于尝试获取内容:使用jfeed编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆