20-1 在行搜索结果信息 - 图1

抓取的结果信息包含:

  • 行家名字
  • 行家主要链接
  • 行家地址
  • 行家头衔
  • 话题最低价格
  • 话题介绍
  • 行家约见用户数
  • 行家评分

结果示例图:

20-1 在行搜索结果信息 - 图2

模板:

  1. {"_id":"zaihang-sosou","startUrl":["https://www.zaih.com/falcon/mentors?keyword=%E8%B5%9A%E9%92%B1&page=[1-5]"],"selectors":[{"id":"info","type":"SelectorElement","parentSelectors":
  2. ["_root"],"selector":"a.mentor-card","multiple":true,"delay":0},{"id":"link","type":"SelectorLink","parentSelectors":["info"],"selector":"_parent_","multiple":false,"delay":0},{"id":"name","type":"SelectorText","parentSelectors":["info"],"selector":"ul","multiple":false,"regex":"","delay":0},{"id":"user","type":"SelectorText","parentSelectors":
  3. ["info"],"selector":"span.mentor-card__number:nth-of-type(1)","multiple":false,"regex":"","delay":0},{"id":"score","type":"SelectorText","parentSelectors":
  4. ["info"],"selector":"span:nth-of-type(3)","multiple":false,"regex":"","delay":0},{"id":"author","type":"SelectorText","parentSelectors":
  5. ["info"],"selector":"span.mentor-card__name","multiple":false,"regex":"","delay":0},{"id":"address","type":"SelectorText","parentSelectors":
  6. ["info"],"selector":"span.mentor-card__location","multiple":false,"regex":"","delay":0},{"id":"author-intro","type":"SelectorText","parentSelectors":["info"],"selector":"div.mentor-card__title","multiple":false,"regex":"","delay":0},{"id":"price","type":"SelectorText","parentSelectors":
  7. ["info"],"selector":"span.mentor-card__price","multiple":false,"regex":"","delay":0}]}

模板套用步骤:

(1)进入需要抓取的话题搜索结果页面,例如:https://www.zaih.com/falcon/mentors?keyword=%E8%B5%9A%E9%92%B1&page=1
(2)导入模板
(3)替换 Start URL为要抓取的网页链接,(抓取多页需修改 Start URL 里的页码数)
(4)开始抓取