2-11 豆瓣某本书的所有评论 - 图1

抓取的结果信息包含:

  • 评论人名字
  • 评论日期
  • 有用数
  • 评论内容

    结果示例图:

    2-11 豆瓣某本书的所有评论 - 图2

    模板:

    1. {"_id":"bookcomment","startUrl":["https://book.douban.com/subject/26781120/comments/hot?p=[1-5]"],"selectors":
    2. [{"id":"aaa","type":"SelectorElement","parentSelectors":
    3. ["_root"],"selector":"li.comment-item","multiple":true,"delay":"2000"},{"id":"name","type":"SelectorText","parentSelectors":
    4. ["aaa"],"selector":".comment-info a","multiple":false,"regex":"","delay":0},{"id":"time","type":"SelectorText","parentSelectors":
    5. ["aaa"],"selector":".comment-info span:nth-of-type(2)","multiple":false,"regex":"","delay":0},{"id":"likes","type":"SelectorText","parentSelectors":
    6. ["aaa"],"selector":"span.vote-count","multiple":false,"regex":"","delay":0},{"id":"content","type":"SelectorText","parentSelectors":["aaa"],"selector":"span.short","multiple":false,"regex":"","delay":0}]}

    模板套用步骤:

    (1)进入需要抓取的书籍评论页面,例如:https://book.douban.com/subject/26781120/comments/hot?p=2
    (2)导入模板
    (3)替换 Start URL为要抓取的网页链接,(抓取多页需修改 Start URL 里的页码数)
    (4)开始抓取