这是用刮痧。你知道吗
我遇到了以下类型的标记:
<p>Noting the presence of a footnote<sup>1</sup> is one common way for superscripts to be used.</p>
测试页面:
https://html.com/tags/sup/
测试查询:
response.css('div.render p::text')[0].extract()
测试项加载器:
loader.add_css("text", "div.render p::text")
测试结果:
Noting the presence of a footnote
预期测试:
Noting the presence of a footnote is one common way for superscripts to be used.
问题:
忽略子标签,如何获取段落的全文?你知道吗
我不知道scrapy是否有适当的选择器忽略嵌套的
<sub>
。我建议您使用re
模块来忽略这个孩子。顺便说一下,从长远来看,这不是一个解决办法。不应该使用regex解析HTML。有关详细信息,请查看此线程RegEx match open tags except XHTML self-contained tags试试这个:
相关问题 更多 >
编程相关推荐