35-3 CSDN 搜索结果博客信息 - 图2

抓取的结果信息包含:

  • 标题
  • 链接
  • 作者名字
  • 阅读数
  • 发布时间

    结果示例图:

    35-3 CSDN 搜索结果博客信息 - 图3

    模板:

    1. {"_id":"csdn-search","startUrl":
    2. ["https://so.csdn.net/so/search/s.do?p=[1-5]&q=MySQL&t=blog&viparticle=&domain=&o=&s=&u=&l=&f=&rbg=0"],"selectors":[{"id":"info","type":"SelectorElement","parentSelectors":
    3. ["_root"],"selector":"dl.search-list","multiple":true,"delay":0},{"id":"title","type":"SelectorLink","parentSelectors":
    4. ["info"],"selector":".limit_width a:nth-of-type(1)","multiple":false,"delay":0},{"id":"author","type":"SelectorText","parentSelectors":
    5. ["info"],"selector":".author-time a","multiple":false,"regex":"","delay":0},{"id":"reads","type":"SelectorText","parentSelectors":["info"],"selector":"span.mr16","multiple":false,"regex":"","delay":0},{"id":"time","type":"SelectorText","parentSelectors":["info"],"selector":"span.date","multiple":false,"regex":"","delay":0}]}

    模板套用步骤:

    (1)进入需要抓取的搜索结果页面,例如:https://so.csdn.net/so/search/s.do?p=1&q=MySQL&t=blog&viparticle=&domain=&o=&s=&u=&l=&f=&rbg=0
    (2)导入模板
    (3)替换 Start URL为要抓取的网页链接,(抓取多页需修改 Start URL 里的页码数)
    (4)开始抓取