image (14).png

抓取的结果信息包含:

  • 房间标题
  • 房间链接
  • 房间类型
  • 地址
  • 房间来源
  • 地铁
  • 价格
  • 房间详细来源
  • 电话

    结果示例图:

    image (15).png

    模板:

    1. {"_id":"ganji-zufang","startUrl":["http://bj.ganji.com/zufang/pn[1-5]/"],"selectors":[{"id":"info","type":"SelectorElement","parentSelectors":
    2. ["_root"],"selector":"div.f-list-item:nth-of-type(n+2)","multiple":true,"delay":""},{"id":"name","type":"SelectorLink","parentSelectors":
    3. ["info"],"selector":"a.js-title","multiple":false,"delay":0},{"id":"style","type":"SelectorText","parentSelectors":["info"],"selector":"dd.size","multiple":false,"regex":"","delay":0},{"id":"address","type":"SelectorText","parentSelectors":
    4. ["info"],"selector":"dd:nth-of-type(3)","multiple":false,"regex":"","delay":0},{"id":"source","type":"SelectorText","parentSelectors":
    5. ["info"],"selector":"dd:nth-of-type(4)","multiple":false,"regex":"","delay":0},{"id":"ditie","type":"SelectorText","parentSelectors":["info"],"selector":"dd.feature","multiple":false,"regex":"","delay":0},{"id":"price","type":"SelectorText","parentSelectors":["info"],"selector":"span.num","multiple":false,"regex":"","delay":0},
    6. {"id":"source-info","type":"SelectorText","parentSelectors":
    7. ["name"],"selector":"div.user-info-top","multiple":false,"regex":"","delay":0},{"id":"phone","type":"SelectorText","parentSelectors":["name"],"selector":"div.phone","multiple":false,"regex":"","delay":0}]}

    模板套用步骤:

    (1)进入需要抓取的房间列表页面,例如:http://bj.ganji.com/zufang/
    (2)导入模板
    (3)替换 Start URL为要抓取的网页链接,(抓取多页需修改 Start URL 里的页码数)
    (4)开始抓取