【发布时间】:2015-08-16 15:33:23
【问题描述】:
我正在尝试使用 parsehub 从网站中提取数据。使用选择工具,我能够隔离每个部分的标题,但我无法使用 alt-click 取消选择第二个标题行的第一个单元格。选择节点标准会发生变化,但实际选择不会发生变化。 有问题的 HTML 块
<tr>
<td width="100%" align="center">
<table width="493">
<tr><td></td></tr>
<tr><td colspan="3"> </td></tr>
<tr bgcolor="#99cc00" height="17">
<th height="17" colspan="3" title="Scratcher Name"><div align="center" class="txt_white_bold">LUCKY 7`S #348</div></th>
</tr>
<tr bgcolor="#99cc00" height="17">
<th height="17"><div align="center" class="txt_white_bold">Prize Amount</div></th>
<th align="right"><div align="center" class="txt_white_bold">Prizes Remaining</div></th>
<th align="right"><div align="center" class="txt_white_bold">Total Prizes</div></th>
</tr>
选择节点代码如下 选择 1
{
"op": "select",
"tag": "TR",
"allDescendants": true,
"flags": [
{
"position": 4
}
]
}
选择 2
{
"op": "select",
"tag": "TH",
"position": 1
}
选择 3
{
"op": "select",
"tag": "DIV",
"classes": [
"txt_white_bold"
],
"position": 1
}
当前输出为
{
"selection1":[
{
"extract1":"LUCKY 7`S #348"
},
{
"extract1":"Prize Amount"
},
等等..我如何只选择“Scratcher Name”而不选择“Prize Amount”?
我的第一个想法是更改“选择 3”以选择 TH 中具有 title="Scratcher Name" 的项目,但我没有成功正确编码。
【问题讨论】:
标签: javascript node.js html-parsing