-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: callback for progress bar #30
Comments
Could you give an example of what you mean by this? In pseudocode or something similar, having trouble picturing it. |
In normal mode, see the output, the user is waiting and sees no anything in output, so it does not know if the operation is in progress or if the application is frozen! cmd_B6oHG4vLgc.mp4But I changed the code like this: (async function() {
const Captcha = require("2captcha");
// Callback for show progress bar
const progressBarCallback = function() {
process.stdout.write(".");
};
// A new 'solver' instance with our API key
const solver = new Captcha.Solver("...", 1000, true, progressBarCallback);
// Example ReCaptcha Website
console.log('Getting captcha...');
await solver.recaptcha("6Ld2sf4SAAAAAKSgzs0Q13IZhY02Pyo31S2jgOB5", "https://patrickhlauke.github.io/recaptcha/")
.then((res) => {
console.log('res:', res);
})
.catch((err) => {
console.error('err:', err);
});
console.log('Finish.');
})(); See result: cmd_wjkCy77mkl.mp4I will try to send it in the form of PR. In a more advanced way, these projects can be used to show the progress bar: Or define it as an event instead of a callback function. For example: solver.on('progress', function() {
process.stdout.write('.');
}); |
Signed-off-by: Nabi <[email protected]>
It would be nice to send a callback to run it while waiting for the captcha to return. To notice the progress of the operation.
The text was updated successfully, but these errors were encountered: