满天星
Fork me on GitHub

失信名单人爬取笔记01

失信名单人爬取

http://shixin.court.gov.cn/

数据采集复杂度确定

1、是否为Https类采集,需要添加证书等操作

2、是否需要模拟登陆

3、模拟登陆的复杂度判定

4、验证码复杂度

5、站点反爬方式

6、站点的反爬力度

7、站点本身的个性方面:资源稀缺性、采集强度、采集量级要求
自前往后
自后往前
随机插入


如果有Received,即意味着发生了改变

//测试的时候可以通过Java GUI来得到输入的验证码
VerifyGuiUtil verifyGuiUtil = new VerifyGuiUtil();
String flag = "login";
String verify_code_input = verifyGuiUtil.getVerifyCode(flag,null,"test_ts",1);
sout("输入的验证码=" + verify_code_input);


自动采集分析:

1、验证码可以重复输入支持

2、tesseract安装与简单测试

3、tesseract的验证码识别工具组件化

4、tesseract识别失信人验证码


cmd->in pwd
tesseract.exe test.jpg tttt

CmdProcessUtil.java: (部分)
public static boolean process(String binPath,String paras){
    BufferedReader br = null;
    try{
        Runtime runtime = Runtime.getRuntime();
        String command_line = binPath + " " + paras;
        logger.info("command_line ---" + command_line);
        Process process = runtime.exec(command_line);
        InputStream is = process.getInputStream();
        process.getErrorStream().close();
        process.getOutputStream().close();
        br = new BufferedReader(new InputStreamReader(is));
        String temp = null;
        while((temp = br.readline())!=null){
            sout(temp);
        }    
        return true;
    }catch(){
        logger.info("phantomjs 在爬取网页信息时出现异常,请检查");
        logger.info(e.getLocalizedMessage());
        return false;
    }finally{
        if(br != null){
            try{
                br.close();
            }catch(){
                xxx
            }
        }
    }

    psvm(){
        String binPath = "D:\\xxxx\\tesseract.exe";
        String paras = "verify.jpg result";
        boolean exec_flag = CmdProcessUtil.process(binPath,paras);
        String verify_code = IOUtil.readFile("result.txt","utf-8").trim();
    }
}
-------------本文结束期待您的评论-------------