2-12 豆瓣小组所有讨论 - 图1

抓取的结果信息包含:

  • 讨论标题
  • 讨论内容链接
  • 作者
  • 回应数
  • 时间

    结果示例图:

    2-12 豆瓣小组所有讨论 - 图2

    模板:

    1. {"_id":"doubangroupdiscussion","startUrl":["https://www.douban.com/group/minimalists/discussion?start=[0-100:25]"],"selectors":[{"id":"element","type":"SelectorElement","parentSelectors":
    2. ["_root"],"selector":"tr:nth-of-type(n+2)","multiple":true,"delay":0},{"id":"title","type":"SelectorLink","parentSelectors":
    3. ["element"],"selector":".title a","multiple":false,"delay":0},{"id":"author","type":"SelectorText","parentSelectors":
    4. ["element"],"selector":"[nowrap] a","multiple":false,"regex":"","delay":0},{"id":"response","type":"SelectorText","parentSelectors":
    5. ["element"],"selector":"td:nth-of-type(3)","multiple":false,"regex":"","delay":0},{"id":"lastresponsetime","type":"SelectorText","parentSelectors":["element"],"selector":"td.time","multiple":false,"regex":"","delay":0},{"id":"content","type":"SelectorText","parentSelectors":
    6. ["title"],"selector":"div.topic-richtext","multiple":false,"regex":"","delay":0},{"id":"time","type":"SelectorText","parentSelectors":
    7. ["title"],"selector":"span.color-green","multiple":false,"regex":"","delay":0}]}

    模板套用步骤:

    (1)进入需要抓取的讨论页面,例如:douban.com/group/minimalists/discussion?start=125
    (2)导入模板
    (3)替换 Start URL为要抓取的网页链接,(抓取多页需修改 Start URL 里的页码数)
    (4)开始抓取