强制 feedparser 清理所有内容类型
对于一个项目,我想使用 feedparser。基本上我已经成功了。
在文档有关清理的部分中描述了并非所有内容类型都被清理。如何强制 feedparser 对所有内容类型执行此操作?
For a project, I want to use feedparser. Basicly I got it working.
In the documentation section about sanitization is described, that not all content types are sanitized. How can I force feedparser to do this on all content types?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为您引用的 feedparser 文档页面提供了很好的建议:
*建议您检查例如条目[i].summary_detail.type 中的内容类型。如果它是文本/纯文本,那么它还没有被清理(并且您应该在渲染内容之前执行 HTML 转义)。*
当然,您可以通过多种方式迭代条目,具体取决于您一次想要对它们执行什么操作他们很干净。
I think the feedparser doc page you referenced gives good advice:
*It is recommended that you check the content type in e.g. entries[i].summary_detail.type. If it is text/plain then it has not been sanitized (and you should perform HTML escaping before rendering the content).*
Of course, there are dozens of ways you can iterate through the entries depending on what you want to do with them once they are clean.