需求如下:
定义二级规则,第一级根据指定线索搜索列表,第二级根据第一级结果抓取详情,已有线索抓取结束后不需要周期性自动激活;如果第一级规则有新线索添加进来,要在现有的ds 打数机中自动运行并抓取数据。
我把本地crontab.xml文件修改了一下,如下:
<?xml version="1.0" encoding="UTF-8"?> <!--注释:<**>与</**>的中间文字可以修改,其他不可修改-->
<crontab> <!--注释:crontab可以有多个thread(即DS爬虫窗口)-->
<thread name="tyc"> <!--注释:自己给thread(DS窗口)起个名字,一个thread里只有一个parameter,可有多个step-->
<parameter>
<type>client</type>
<auto>true</auto>
<start>1</start>
<period>10</period> <!--注释:period为调度周期,单位为秒, 如果要每天都采集一遍的话,就要设为86400(24X60X60)-->
<waitOnload>false</waitOnload>
<minIdle>2</minIdle>
<maxIdle>10</maxIdle>
</parameter>
<step name="renewClue"> <!--注释:激活线索的step,激活的周期由parameter中的period决定-->
<theme>tyc_search_result_final_gx</theme>
</step>
<step name="crawl"> <!--注释:采集第一个规则数据的step-->
<theme>tyc_search_result_final_gx</theme>
<loadTimeout>10000</loadTimeout>
<lazyCycle>3</lazyCycle>
<updateClue>true</updateClue>
<dupRatio>100</dupRatio> <!--下级线索重复容忍度,用于控制新增数据采集,0表示遇到重复的下级线索就中断采集,100表示从头到尾采一遍 -->
<timerTriggered>false</timerTriggered>
<depth>-1</depth> <!--注释:控制翻页次数,-1表示不限制翻页 -->
<width>1</width> <!--注释:控制一轮采集多少条线索网址 -->
<scrollWindowRatio>2</scrollWindowRatio> <!--滚屏速度,可正可负的整数,-1和1相同,表示不变速。小于 -1 表示降低速度,大于1 表示提高速度 -->
<scrollMorePages>1</scrollMorePages> <!--注释:控制滚屏速度,0表示不滚屏,数值越大,采集越慢,注意:抓动态网页必须滚屏 -->
<stopOnDupCont>true</stopOnDupCont>
<closePopup>false</closePopup>
<allowPlugin>false</allowPlugin>
<allowImage>false</allowImage>
<allowJavascript>true</allowJavascript>
</step>
<step name="crawl"> <!--注释:采集第二个规则数据的step-->
<theme>tyc_search_result_detail_qybj_s_gx</theme>
<loadTimeout>10000</loadTimeout>
<lazyCycle>3</lazyCycle>
<updateClue>true</updateClue>
<dupRatio>100</dupRatio>
<timerTriggered>true</timerTriggered>
<depth>-1</depth>
<width>-1</width>
<scrollWindowRatio>2</scrollWindowRatio>
<scrollMorePages>1</scrollMorePages>
<stopOnDupCont>true</stopOnDupCont>
<closePopup>false</closePopup>
<allowPlugin>false</allowPlugin>
<allowImage>false</allowImage>
<allowJavascript>true</allowJavascript>
</step>
</thread>
</crontab>
这样做的结果是二级自动联动,但由于period指定了10秒,这样每隔10秒就会自动激活所有线索,我不需要自动激活,要怎么修改本地文件?
xml文件能设置让ds打数机每隔设置固定的时间检测一次现有规则中的线索,如果出现待抓取的线索,ds打数机就自动抓取吗?
|
|
|
|
|
共 2 个关于本帖的回复 最后回复于 2017-5-22 08:08