Closed rannmann closed 10 years ago
Hello, perhaps they have updated their API? I haven't worked on or used this library in quite some time, so I'm unsure what the state of it is.
Closing this due to no response.
I also encountered this problem. That is my solution by some of try, and I think this manner of use RequestJS for multipart post is more simpler.
// img = fs.createReadStream(imgPath)
DeathByCaptcha.prototype.solve = function(img, cb) {
var _this = this;
var r = request.post({
uri: 'http://api.dbcapi.me/api/captcha'
}, function(err, resp, body){
// no different!
});
var form = r.form();
form.append('username', this.username);
form.append('password', this.password);
form.append('captchafile', img);
return r;
}
@yicone nice work, could you submit a pull request that fixes the issue? I'll merge it in and make a new release straight away.
I've used this module in the past and had no issues, but the exact same code seems to be failing now. I can still log in to DBC and check my balance, but when an image is submitted (only tested by stream), the response is always a 403 Forbidden. I've taken the issue up with support, and they said it's not an issue on their end (still skeptical about that). I tested with the command line tool they provide, and it seems to work fine.
I'm not sure if something changed in the past month or two in their API, but from reading the docs it seems like it should work. Below is a captured POST request for reference.