2captcha / 2captcha-csharp

C# library for easy integration with the API of 2captcha captcha solving service to bypass recaptcha, funcaptcha, geetest and solve any other captchas.
https://www.nuget.org/packages/2captcha-csharp
MIT License
92 stars 28 forks source link

Cannot Instantiate 2Captcha Object in .Net6. #26

Closed shishank-bsc closed 1 month ago

shishank-bsc commented 9 months ago

I am trying to integrate 2Captcha service in my .Net6 Application.

I have installed this nuget package: https://www.nuget.org/packages/2captcha-csharp/

I added the namespace: using TwoCaptcha.Captcha;

But I am not able to instantiate the object:

TwoCaptcha solver = new TwoCaptcha('YOUR_API_KEY'); reCAPTCHA captcha = new reCAPTCHA(); Getting error here.

How can I resolve this?

https://stackoverflow.com/questions/77986229/cannot-instantiate-twocaptcha-object-in-net-6

tuannh6495 commented 5 months ago

TwoCaptcha.TwoCaptcha solver = new TwoCaptcha.TwoCaptcha(ApiKey); I got same your issue. I should try it!

tuannh6495 commented 5 months ago

https://github.com/2captcha/2captcha-csharp/issues/2

victorkowalski commented 1 month ago

Example of use: @shishank-bsc @tuannh6495


namespace ConsoleApp1
{
    using TwoCaptcha;
    using TwoCaptcha.Captcha;
    using TwoCaptcha.Exceptions;

    class Program
    {

        static void Main(string[] args)
        {
            TwoCaptcha solver = new TwoCaptcha("55555555555555555555");

            Text captcha = new Text("If tomorrow is Saturday, what day is today?");

            try
            {
                solver.Solve(captcha).Wait();
                Console.WriteLine("Captcha solved: " + captcha.Code);
            }
            catch (AggregateException e)
            {
                Console.WriteLine("Error occurred: " + e.InnerExceptions.First().Message);
            }
        }
    }
}