skotz / cbl-js

JavaScript CAPTCHA solving library
MIT License
155 stars 47 forks source link

Can you help implement on node.js #57

Open tuer12033 opened 3 years ago

tuer12033 commented 3 years ago

a code example in repo use for HTML so, I can use this code on node js? or you can tell me about the way for use

var cbl = new CBL({
    preprocess: function(img) {
        img.binarize(220);
        img.colorRegions(50);
    },
    /* Load the model we saved during training. */
    model_file: './model.txt',
    character_set: "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",
    blob_min_pixels: 50,
    blob_max_pixels: 400,
    pattern_width: 25,
    pattern_height: 25,
    perceptive_colorspace: true,
    /* Define a method that fires immediately after successfully loading a saved model. */
    model_loaded: function() {
        // Don't enable the solve button until the model is loaded.
        // document.getElementById('solve').style.display = "block";
    }
});    

cbl.solve("./captcha.png").done(function (solution) {
    // Upon finding a solution, fill the solution textbox with the answer.
    console.log('====================================');
    console.log(solution);
    console.log('====================================');
});
skotz commented 3 years ago

CBL relies on several browser objects like XMLHttpRequest and document (among others) so I'm not sure how much work it would be to update the library to support this. It's possible, just not something I've tried to implement yet.