【发布时间】:2021-01-20 00:34:30
【问题描述】:
我正在使用 Scrapy,我正在尝试抓取类似这样的内容:
<html>
<div class='hello'>
some elements
.
.
.
</div>
<div class='hi there'>
<div>
<h3> title </h3>
<h4> another title </h4>
<p> some text ..... </p>
"some text without any tag"
<div class='article'>
some elements
.
.
</div>
<div class='article'>
some elements
.
.
</div>
<div class='article'>
some elements
.
.
</div>
</div>
</div>
</html>
如果我想从类名为“hi there”的 div 下和类名为“article”的 div 之前的所有元素中提取文本,是否有任何可能的方式使用 XPath 或 CSS 选择器?
【问题讨论】:
标签: python xpath scrapy css-selectors