GAE 的 HTML 解析器
通常,我使用 lxml 来满足 HTML 解析需求,但这在 Google App Engine 上不可用。明显的替代方案是 BeautifulSoup,但我发现它在格式错误的 HTML 上太容易被阻塞。目前我正在测试 libxml2dom 并得到了更好的结果。
您发现哪种纯 Python HTML 解析器性能最好?我的首要任务是处理不良 HTML 的能力而不是速度。
Generally I use lxml for my HTML parsing needs, but that isn't available on Google App Engine. The obvious alternative is BeautifulSoup, but I find it chokes too easily on malformed HTML. Currently I am testing libxml2dom and have been getting better results.
Which pure Python HTML parser have you found performs best? My priority is the ability to handle bad HTML over speed.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
来自 BeautifulSoup 文档:
,它可能会帮助您使用这个早期版本。这正是作者本人所推荐的。
From the BeautifulSoup documentation:
So, it might help you to use this earlier version. That is precisely what the author himself recommends.
不再是问题 - 支持 lxml:
https://developers.google.com/appengine/docs/python/tools/图书馆27
No longer a problem - lxml is supported:
https://developers.google.com/appengine/docs/python/tools/libraries27