image (1).png

抓取的结果信息包含:

  • 文章标题
  • 文章链接
  • 赞同数
  • 评论数

    结果示例图:

    image (2).png
    模板:
    1. {"_id":"zhangjiawei2","startUrl":["https://www.zhihu.com/people/zhang-jia-wei/posts?page=[1-5]"],"selectors":
    2. [{"id":"info","type":"SelectorElement","parentSelectors":
    3. ["_root"],"selector":"div.List-item","multiple":true,"delay":0},{"id":"title","type":"SelectorLink","parentSelectors":
    4. ["info"],"selector":"h2 a","multiple":false,"delay":0},{"id":"likes","type":"SelectorText","parentSelectors":["info"],"selector":"button.VoteButton--up","multiple":false,"regex":"","delay":0},{"id":"comments","type":"SelectorText","parentSelectors":["info"],"selector":"button.ContentItem-action:nth-of-type(1)","multiple":false,"regex":"","delay":0}]}

    模板套用步骤:

    (1)进入大V文章页面,例如:https://www.zhihu.com/people/zhang-jia-wei/posts
    (2)导入模板
    (3)替换 Start URL为要抓取的网页链接,修改要抓取的页数,比如:”[1-5]“是 第 1 页到第 5 页所有文章。
    (4)开始抓取