本文为小旋风蜘蛛池写后台采集规则的全套教程,如您会使用火车头采集器或者简数采集器,则本教程跳过,简单易用。
本文仅以小旋风蜘蛛池X6版本为例,如有不明白的地方可以在文末留言。
一、小旋风蜘蛛池如何采集标题
标题库采集还是很简单的,只需要设置一下采集源的地址就可以。
首先添加采集规则,选择文章标题。
分页的写法:
http://roll.news.sina.com.cn/news/gnxw/gdxw1/index_{p,1,9,1}.shtml
{p,1,5,1}表示分页,参数:p后面的数字分别代表开始、结束、递增/减值,即{p,开始,结束,递增/减值}
http://roll.news.sina.com.cn/news/gnxw/gdxw1/index_1.shtml
http://roll.news.sina.com.cn/news/gnxw/gdxw1/index_2.shtml
http://roll.news.sina.com.cn/news/gnxw/gdxw1/index_3.shtml
http://roll.news.sina.com.cn/news/gnxw/gdxw1/index_4.shtml
http://roll.news.sina.com.cn/news/gnxw/gdxw1/index_5.shtml
http://roll.news.sina.com.cn/news/gnxw/gdxw1/index_6.shtml
http://roll.news.sina.com.cn/news/gnxw/gdxw1/index_7.shtml
http://roll.news.sina.com.cn/news/gnxw/gdxw1/index_8.shtml
http://roll.news.sina.com.cn/news/gnxw/gdxw1/index_9.shtml
测试规则的时候可以从网址匹配里看到。 添加后,测试看看效果:
二、小旋风蜘蛛池如何采集句子及文章
添加规则:选择整篇内容或者句子段落
比如说我们要采集新浪新闻,地址是:https://news.sina.com.cn/,就在列表配置选项的匹配网址里填上以上地址。
打开采集源的地址,选择其中一篇新闻。复制它的链接地址。
这里的是地址是:https://news.sina.com.cn/c/2019-05-03/doc-ihvhiewr9625655.shtml
然后,内容匹配规则可以这样写
https://news.sina.com.cn/(w)/(d)-(d)-(d)/(w)-(w).shtml
内容截取规则:
打开内容地址。右键查看源码,找到内容区域。
然后内容截取规则可以这样写:
像新浪这种大型网站,它的内容页有些是不一样的,我们可以写多几个匹配。
保存后,看看效果。
注:您采集句子、文章的同时会自动采集到图片链接,所以不用担心您的内容库里面没有图片!