Zaczero/2Captcha

Sending Images fails

TKGNET opened this issue · 3 comments

I used your Nuget package first for a rotate captcha request (c#, framework 4.6.1)
Always failed with 'ERROR_ROTATECAPTCHA' in the response.
Went here to look at the source code: SolveRotateCaptcha(stream(),angle) does not send a filename, nor does it add a content-type header.
Changing the source to add filename: 'test.png' solved the issue.

Hey, do you mind forking the repo and making a pull request? Sounds like you have already found a solution so I will happily accept that change :-)

For a minor change I wouldn't mind - but I cant even say if it is a general bug , or just caused by a different implementation of the httpclient in the .NET framework. I used NET 4.6.2, yours is based on NET Standard.
Anyway, if it has been caused by a change of 2captcha's server implementation it is not just a small change, but affects at least 2 of your public methods which send a multipart request.

I just used your code as a check when my own implementation failed, but got the same error.

When sending a multipart request, 2captcha expects a clue what kind of file has been sent:
tried with an appropriate content-type , f.e. image/png , but 2captcha ignores it.
So what you will have to do is sending a fileName parameter with the appropriate extension, f.e. test.png, or test.jpg

You can't get this Imaging.Format from a stream, so your API breaks, I'm afraid.

Cheers, Pete

Orlys commented

@Zaczero I got error ERROR_ZERO_CAPTCHA_FILESIZE when I calling SolveImage(stream), but the given stream length is always greater than 100 bytes.