【发布时间】:2020-05-02 19:50:33
【问题描述】:
我只是一个scrapy的初学者面临一些问题:
<tr>
<td rowspan="2" style="vertical-align: top; width: 20%;">
1. c4<br>
<script type="text/javascript">
...
<\script>
</td>
<td style="vertical-align: top;">The English Defense, here I give up the centre to Black as a target for attack.</td>
</tr>
如果我想同时获取"c4" 文本和"The English Defense, here I give up the centre to Black as a target for attack.",可以使用response.css('tr td::text').extract()。
但是如果我只想要第二个<td> 标签的文本,我该怎么办,因为<td> 标签没有id 或class 或其他任何东西? In this link,我没有找到使用style或rowspan的解决方案...
【问题讨论】:
标签: css python-3.x scrapy web-crawler