public ResolvedCaptcha GetResolvedCaptcha() { Captcha c = new Captcha("http://www.erepublik.com/en"); return new ResolvedCaptcha(c.ChallengeID, c.ResolveAntigate(m_Key)); }
public static bool Vote(string voteURL, string referrer, bool doVote) { ConsoleLog.WriteLine("Vote URL (doVote=" + doVote.ToString() + "): " + voteURL); string response; client.Referer = referrer; client.Headers.Remove("X-Requested-With"); response = client.DownloadString(voteURL); //ConsoleLog.WriteLine(response, "Response1.txt"); if (!doVote) return true; if (!response.Contains("<div id=\"contestBlock\">")) { ConsoleLog.WriteLine("Bad page loaded"); return false; } if (response.Contains("<div id=\"kaptchaBlock\">")) { ConsoleLog.WriteLine("Loaded"); response = CommonUtils.GetStringBetween( response, "<div id=\"kaptchaBlock\">", "<input type=\"image\""); string imageURL = baseURL + CommonUtils.GetStringBetween( response, "<img src=\"", "\">"); string challengeID = CommonUtils.GetStringBetween( response, "<input type=\"hidden\" id=\"itemvote\" value=\"", "\">"); response = "-1"; while (response.Contains("-1")) { ConsoleLog.WriteLine("Getting captcha..."); byte[] image = client.DownloadData(imageURL); Captcha captcha = new Captcha(image); ConsoleLog.WriteLine( "imageURL=" + imageURL + ", " + "challengeID=" + challengeID); string challengeText = captcha.ResolveAntigate(Globals.BotConfig.AntiGateKey); client.Headers.Add("X-Requested-With", "XMLHttpRequest"); client.Referer = voteURL; string PostData = "item=" + challengeID + "&votekey=" + challengeText; response = client.UploadString(baseURL + "/contest/spvoting.php", PostData); //ConsoleLog.WriteLine(response, "Response2.txt"); } bool result = response.Contains("<a href=\"/bestsp.php\">"); ConsoleLog.WriteLine("URL voted. Result=" + result); return result; } else { ConsoleLog.WriteLine("IP/URL allready voted"); return false; } }