static void Main(string[] args)
        {
            TwoCaptchaClient client = new TwoCaptchaClient("apikey");

            string result;
            bool   succeeded = client.SolveRecaptchaV2("6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-", "https://www.google.com/recaptcha/api2/demo", "username:password@ip:port", ProxyType.HTTP, out result);

            Console.WriteLine(result);
            Console.WriteLine(succeeded);
            Console.ReadKey();
        }
Esempio n. 2
0
 public Account(string apiKey)
 {
     captchaClient = new TwoCaptchaClient(apiKey);
     resetHttpClient();
 }
Esempio n. 3
0
        static void Main(string[] args)
        {
            string          channelurl   = "https://www.youtube.com/user/schafer5";
            YouTube         _YouTube     = new YouTube();
            string          responseData = string.Empty;
            string          result;
            CookieContainer cookies = new CookieContainer();

            responseData = GetFirstRespParams(channelurl + "/about", ref cookies);
            HtmlAgilityPack.HtmlDocument htmlDocument = new HtmlAgilityPack.HtmlDocument();
            htmlDocument.LoadHtml(responseData);
            HtmlNodeCollection subscribercount = htmlDocument.DocumentNode.SelectNodes("//span[@class='yt-subscription-button-subscriber-count-branded-horizontal subscribed yt-uix-tooltip']");

            if (subscribercount != null)
            {
                _YouTube.Subscribers = subscribercount[0].InnerText.Trim().Replace("subscribers", "");
            }
            HtmlNodeCollection Views = htmlDocument.DocumentNode.SelectNodes("//span[@class='about-stat']");

            if (Views != null)
            {
                foreach (var item in Views)
                {
                    if (item.InnerText.Trim().Contains("views"))
                    {
                        _YouTube.Views = item.InnerText.Trim().Replace("views", "");
                        _YouTube.Views = _YouTube.Views.Trim().Replace("• ", "");
                        break;
                    }
                }
            }
            HtmlNodeCollection Name = htmlDocument.DocumentNode.SelectNodes("//span[@class='qualified-channel-title-text']");

            if (Name != null)
            {
                foreach (var item in Name)
                {
                    if (item.InnerText.Trim() != string.Empty)
                    {
                        _YouTube.Name = Name[0].InnerText.Trim();
                    }
                }
            }
            _YouTube.ChannelUrl = channelurl;

            bool isemailbutton             = false;
            HtmlNodeCollection EmailButton = htmlDocument.DocumentNode.SelectNodes("//paper-button[@class='style-scope ytd-button-renderer style-default size-default']");

            if (EmailButton != null)
            {
                foreach (var item in EmailButton)
                {
                    if (item.InnerText.Trim().Contains("View email address"))
                    {
                        isemailbutton = true;
                    }
                }
            }
            if (!isemailbutton)
            {
                Regex         reg = new Regex(@"[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,6}", RegexOptions.IgnoreCase);
                Match         match;
                List <string> results = new List <string>();
                for (match = reg.Match(responseData); match.Success; match = match.NextMatch())
                {
                    if (!(results.Contains(match.Value)))
                    {
                        _YouTube.Email = match.Value;
                    }
                }
            }
            else
            {
                int    sta     = responseData.IndexOf("XSRF_TOKEN") + 11;
                int    end     = responseData.IndexOf("XSRF_FIELD_NAME");
                string session = responseData.Substring(sta, end - sta).Replace(": \"", "");
                session = session.Replace("\",\n      '", "");
                sta     = responseData.IndexOf("yt.setConfig('CHANNEL_ID',") + "yt.setConfig('CHANNEL_ID',".Length;
                end     = responseData.IndexOf("yt.setConfig('CHANNEL_TAB',");
                string channeid = responseData.Substring(sta, end - sta).Replace("\");\n\n\n    ", "");
                channeid = channeid.Replace(" \"", "");
                string postData = String.Format("session_token=" + session);
                string HostName = "www.youtube.com";
                responseData = GetDataWithParams("https://www.youtube.com/channels_profile_ajax?action_get_business_email_captcha=1", ref cookies, postData, HostName);

                TwoCaptchaClient client = new TwoCaptchaClient("API Key");

                bool succeeded = client.SolveRecaptchaV2("6Lf39AMTAAAAALPbLZdcrWDa8Ygmgk_fmGmrlRog", "https://www.youtube.com/user/schafer5/about", "username:password@ip:port", ProxyType.HTTP, out result);

                postData     = String.Format("channel_id=" + channeid + "&g-recaptcha-response=" + result + "&session_token=" + session);
                responseData = GetDataWithParams("https://www.youtube.com/channels_profile_ajax?action_verify_business_email_recaptcha=1", ref cookies, postData, HostName);

                sta = responseData.IndexOf("href=\"mailto:") + "href=\"mailto:".Length;
                end = responseData.IndexOf("\" target = ");
                string email = responseData.Substring(sta, end - sta).Replace("\");\n\n\n    ", "");
                email          = email.Replace(" \"", "");
                _YouTube.Email = email;
            }
            _YouTubeList.Add(_YouTube);
        }