我正在使用 Python2.7 和 feedparser。我需要阅读 wordpress 站点的提要。我可以读取一些常见的提要标签,例如提要中每个项目的 title、content...,但我无法阅读一些添加的自定义提要。
提要网址是:http://www.aecinema.ir/feed/ .
您可以在每个项目中看到图像标签,这是一个“添加的提要”,但我看不懂。
我的代码:
feed = feedparser.parse("http://www.aecinema.ir/feed/")
for item in feed["items"]:
print item["title"], item["image"]
我也阅读如下提要:
print feed.entries[0].title, feed.entries[0].image
但在每种情况下,错误都是相同的。
错误:对象没有属性 'image'
代码有什么问题??? :(
请您参考如下方法:
代码很好,但提要无效。参见 validation results .
<image>未在 RSS 2.0 specification 中定义作为<item>子元素,因此 feedparser 不处理它们。
