赞同数
结果示例图:
模板:
{"_id":"zhidao","startUrl":["https://zhidao.baidu.com/search?word=%C8%E7%BA%CE%D0%B4%D7%F7&ie=gbk&site=-1&sites=0&date=0&pn=[0-20:10]"],"selectors":[{"id":"info","type":"SelectorElement","parentSelectors":["_root"],"selector":"dl","multiple":true,"delay":0},{"id":"title","type":"SelectorLink","parentSelectors":
["info"],"selector":"dt a","multiple":false,"delay":0},{"id":"intro","type":"SelectorText","parentSelectors":["info"],"selector":"dd.answer","multiple":false,"regex":"","delay":0},{"id":"time","type":"SelectorText","parentSelectors":
["info"],"selector":"span:nth-of-type(1)","multiple":false,"regex":"","delay":0},{"id":"author","type":"SelectorText","parentSelectors":
["info"],"selector":"span:nth-of-type(2)","multiple":false,"regex":"","delay":0},{"id":"answers","type":"SelectorText","parentSelectors":
["info"],"selector":"span:nth-of-type(3)","multiple":false,"regex":"","delay":0},{"id":"likes","type":"SelectorText","parentSelectors":
["info"],"selector":"span.ml-10","multiple":false,"regex":"","delay":0}]}
使用方式:
(1)进入需要抓取的搜索结果页面,例如:https://zhidao.baidu.com/search?word=%C8%E7%BA%CE%D0%B4%D7%F7&ie=gbk&site=-1&sites=0&date=0&pn=0
(2)导入模板
(3)替换 Start URL为要抓取的网页链接,(抓取多页需修改 Start URL 里的页码数,比如:
网址链接最后的“pn=[0-20:10]”,表示抓1-3页,如果要抓1-N页,需要把“:”前面的数字,改成页码对应的数字)
(4)开始抓取