All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.datastax.insight.web.spider.Spider Maven / Gradle / Ivy

//package com.datastax.insight.web.spider;
//
//import com.datastax.insight.spec.Operator;
//import com.datastax.web.spider.handler.PageHandler;
//
//import java.util.HashMap;
//import java.util.Map;
//
//public class Spider implements Operator {
//    public static Map scrap(String url,int threads){
//        Map map=new HashMap<>();
//
//        PageHandler pageHandler= page -> {map.put(page.getUrl(),page.getText());
//            System.out.println(page.getUrl());System.out.println(page.getText());};
//
//        com.datastax.web.service.Spider.build(false)
//                .urls(url).threads(threads).addPageHandler(pageHandler)
//                .run();
//
//        return map;
//    }
//
//    public static void main(String[] args){
//        String url="http://baike.baidu.com/view/{1-50}.htm";
//        Map map=Spider.scrap(url,5);
//        System.out.println(map.size());
//    }
//}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy