4-2 百度知道某个问题的所有回答 - 图1

抓取的结果信息包含:

  • 回答内容
  • 赞同数
  • 评论数
  • 发布时间
  • 作者名字

    结果示例图:

    4-2 百度知道某个问题的所有回答 - 图2

    模板:

    1. {"_id":"zhidao-huida","startUrl":["https://zhidao.baidu.com/question/24259898.html?sort=11&rn=5&pn=[0-10:5]#wgt-answers"],"selectors":[{"id":"info","type":"SelectorElement","parentSelectors":["_root"],"selector":"div.bd.answer","multiple":true,"delay":0},{"id":"content","type":"SelectorText","parentSelectors":
    2. ["info"],"selector":"div.mb-10","multiple":false,"regex":"","delay":0},{"id":"likes","type":"SelectorText","parentSelectors":
    3. ["info"],"selector":".evaluate b","multiple":false,"regex":"","delay":0},{"id":"comments","type":"SelectorText","parentSelectors":
    4. ["info"],"selector":".comment em","multiple":false,"regex":"","delay":0},{"id":"time","type":"SelectorText","parentSelectors":
    5. ["info"],"selector":"span.wgt-replyer-all-time","multiple":false,"regex":"","delay":0},{"id":"author","type":"SelectorText","parentSelectors":
    6. ["info"],"selector":"span.wgt-replyer-all-uname","multiple":false,"regex":"","delay":0}]}

    模板套用步骤:

    (1)进入需要抓取的问题回答页面,例如:https://zhidao.baidu.com/question/24259898.html?sort=11&rn=5&pn=0#wgt-answers
    (2)导入模板
    (3)替换 Start URL为要抓取的网页链接,(抓取多页需修改 Start URL 里的页码数)
    (4)开始抓取