如何使用独立标签和列表页标签?

- 作者:火车采集器官网 ——来源:火车采集器官网 ——

火车采集器V9有了新的功能,功能就是独立标签和列表页标签的功能。采集数据时,如果列表页有一个字段需要分配到每一篇详情页时我们可以使用列表页独立标签功能。如果我们要采集的数据在列表页,那么可以使用列表页标签功能,这样我们可以在列表页把所需要的的数据都采集到,可以大大节约时间和提升爬取速度。下面我们用http://www.ccgp-shanxi.gov.cn/view.php?app=&type=&nav=100&page=1做测试,图中的名称,地区和状态是我要的值,我只要当前列表的数据。

     

     

    这是需要采集的源码信息      

<tbody><tr class='odd' style='height:30px;'><td nowrap><input type='hidden' value='2020-07-10' id='sdate0'/><input type='hidden' value='2020-08-03' id='fdate0'/><a href='view.php?nid=651503' target='_blank' title="垣曲县公安局社会资源融合应用平台建设项目招标公告">垣曲县公安局社会资源融合应用平台建设项目招标公告</a></td><td nowrap>运城市垣曲县</td><td nowrap><font color="#0066FF">招标中</font></td><td  nowrap>[2020-07-10]</td></tr><tr class='even' style='height:30px;'><td nowrap><input type='hidden' value='2020-07-10' id='sdate1'/><input type='hidden' value='2020-07-23' id='fdate1'/><a href='view.php?nid=651513' target='_blank' title="垣曲县自来水公司二水厂厂区供水工程磋商公告">垣曲县自来水公司二水厂厂区供水工程磋商公告</a></td><td nowrap>运城市垣曲县</td><td nowrap><font color="#0066FF">招标中</font></td><td  nowrap>[2020-07-10]</td></tr><tr class='odd' style='height:30px;'><td nowrap><input type='hidden' value='2020-07-10' id='sdate2'/><input type='hidden' value='2020-07-20' id='fdate2'/><a href='view.php?nid=651690' target='_blank' title="沁水经济技术开发区管理委员会防洪影响评价及水土保持方案报告编制项目谈判公告">沁水经济技术开发区管理委员会防洪影响评价及水土保持... </a></td><td nowrap>晋城市沁水县</td><td nowrap><font color="#0066FF">招标中</font></td><td  nowrap>[2020-07-10]</td></tr><tr class='even' style='height:30px;'><td nowrap><input type='hidden' value='2020-07-10' id='sdate3'/><input type='hidden' value='2020-07-23' id='fdate3'/><a href='view.php?nid=651563' target='_blank' title="灵丘县民政局武灵中心敬老院室内改造工程磋商公告">灵丘县民政局武灵中心敬老院室内改造工程磋商公告</a></td><td nowrap>大同市灵丘县</td><td nowrap><font color="#0066FF">招标中</font></td><td  nowrap>[2020-07-10]</td></tr><tr class='odd' style='height:30px;'><td nowrap><input type='hidden' value='2020-07-10' id='sdate4'/><input type='hidden' value='2020-07-24' id='fdate4'/><a href='view.php?nid=651427' target='_blank' title="山西农谷管理委员会晋中国家农业高新技术产业示范区(山西农谷)建设发展规划磋商公告">山西农谷管理委员会晋中国家农业高新技术产业示范区(... </a></td><td nowrap>晋中市太谷县</td><td nowrap><font color="#0066FF">招标中</font></td><td  nowrap>[2020-07-10]</td></tr><tr class='even' style='height:30px;'><td nowrap><input type='hidden' value='2020-07-10' id='sdate5'/><input type='hidden' value='2020-08-03' id='fdate5'/><a href='view.php?nid=651666' target='_blank' title="永济市城西街道雪亮工程采购公告">永济市城西街道雪亮工程采购公告</a></td><td nowrap>运城市永济市</td><td nowrap><font color="#0066FF">招标中</font></td><td  nowrap>[2020-07-10]</td></tr><tr class='odd' style='height:30px;'><td nowrap><input type='hidden' value='2020-07-10' id='sdate6'/><input type='hidden' value='2020-07-16' id='fdate6'/><a href='view.php?nid=651664' target='_blank' title="阳泉市园林管理处百团大战纪念馆安防及讲解系统安装工程谈判公告">阳泉市园林管理处百团大战纪念馆安防及讲解系统安装工... </a></td><td nowrap>阳泉市</td><td nowrap><font color="#0066FF">招标中</font></td><td  nowrap>[2020-07-10]</td></tr><tr class='even' style='height:30px;'><td nowrap><input type='hidden' value='2020-07-10' id='sdate7'/><input type='hidden' value='2020-07-24' id='fdate7'/><a href='view.php?nid=651569' target='_blank' title="编制清徐县新型城镇化示范县城实施方案磋商公告">编制清徐县新型城镇化示范县城实施方案磋商公告</a></td><td nowrap>太原市清徐县</td><td nowrap><font color="#0066FF">招标中</font></td><td  nowrap>[2020-07-10]</td></tr><tr class='odd' style='height:30px;'><td nowrap><input type='hidden' value='2020-07-10' id='sdate8'/><input type='hidden' value='2020-07-16' id='fdate8'/><a href='view.php?nid=651308' target='_blank' title="灵石县段纯镇东西街道改造工程及镇区人行道附属工程谈判公告">灵石县段纯镇东西街道改造工程及镇区人行道附属工程谈... </a></td><td nowrap>晋中市灵石县</td><td nowrap><font color="#0066FF">招标中</font></td><td  nowrap>[2020-07-10]</td></tr><tr class='even' style='height:30px;'><td nowrap><input type='hidden' value='2020-07-10' id='sdate9'/><input type='hidden' value='2020-07-29' id='fdate9'/><a href='view.php?nid=651655' target='_blank' title="浮山县财政局确定采购定点供应商项目磋商公告">浮山县财政局确定采购定点供应商项目磋商公告</a></td><td nowrap>临汾市浮山县</td><td nowrap><font color="#0066FF">招标中</font></td><td  nowrap>[2020-07-10]</td></tr>
</tbody>

    我们把上图中的源码复制到采集器里面,然后在采集器里面进行修改,把要采集的字段修改成对应的标签。

    把对应的值都设置好:比如要采集标题的话,使用这个[标签:标题]。如果要采集级别,使用这个[标签:级别]。其它标签使用类似的格式即可,[标签:状态]。

    点击测试之后我们测试看看采集结果如何

    我们再来看看列表页独立标签的用法,点开网址采集右下角的高级设置会有列表页独立标签,之后我们以标题为例,采集一下当前列表页的一个标题和列表页采集的原标题对比看看有什么区别

     

     

    我们可以看到这个列表页独立标签采集到的标题和原标题除了当前列表第一个是一致的,后面都不一样,也就是说独立标签的值取到了第一个之后后面的就都是这个值,我们正式运行看下效果

    这里就可以清晰的看到了两个标签的不同用法,这也算列表页标签和独立标签的一个区别,如果要想获取当前列表的值呢?比如说获取当前采集的数据是第几页的,那么可以看下面的图片,比如说我要采集这个页数,那么这里我们就这要设置,记得勾选上从列表页网址采集。火车脚本网

     

如果你还有其它疑问可以来本站搜索相关问题,这里会有你想要的答案:火车脚本网

还有什么疑问可以提出来
  • 全部评论(0
    还没有评论,快来抢沙发吧!