5-1 简书搜索结果所有文章信息 - 图1

抓取的结果信息包含:

  • 文章标题
  • 文章内容链接
  • 阅读数
  • 评论数
  • 点赞数
  • 作者
  • 时间

    结果示例图:

    5-1 简书搜索结果所有文章信息 - 图2

    模板:

    1. {"_id":"jianshu-bt","startUrl":["https://www.jianshu.com/search?q=%E5%86%99%E4%BD%9C&page=[1-4]&type=note"],"selectors":[{"id":"info","type":"SelectorElement","parentSelectors":["_root"],"selector":"div.content","multiple":true,"delay":0},{"id":"title","type":"SelectorLink","parentSelectors":["info"],"selector":"a.title","multiple":false,"delay":0},{"id":"reads","type":"SelectorText","parentSelectors":
    2. ["info"],"selector":".meta a:nth-of-type(1)","multiple":false,"regex":"","delay":0},{"id":"comments","type":"SelectorText","parentSelectors":
    3. ["info"],"selector":"a:nth-of-type(2)","multiple":false,"regex":"","delay":0},{"id":"likes","type":"SelectorText","parentSelectors":
    4. ["info"],"selector":".meta span","multiple":false,"regex":"","delay":0},{"id":"author","type":"SelectorText","parentSelectors":["info"],"selector":"a.nickname","multiple":false,"regex":"","delay":0},{"id":"time","type":"SelectorText","parentSelectors":["info"],"selector":"span.time","multiple":false,"regex":"","delay":0}]}

    模板套用步骤:

    (1)进入需要抓取的搜索结果页,例如:https://www.jianshu.com/search?q=%E5%86%99%E4%BD%9C&page=1&type=note
    (2)导入模板
    (3)替换 Start URL为要抓取的网页链接,(抓取多页需修改 Start URL 里的页码数)
    (4)开始抓取