Package: captchatools
Captcha ToolsPython module to help solve captchas with Capmonster, 2Captcha and Anticaptcha API's!Go(lang)To see documentation for the Go implementation,click hereInstallpip3installcaptchatoolsTo updatepip3install-UcaptchatoolsHow to useBasic usageimportcaptchatoolssolver=captchatools.new_harvester(solving_site="capmonster",api_key="YOUR API KEY",sitekey="6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-",captcha_url="https://www.google.com/recaptcha/api2/demo")captcha_answer=solver.get_token()orfromcaptchatoolsimportnew_harvestersolver=new_harvester(solving_site=1,api_key="YOUR API KEY",sitekey="6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-",captcha_url="https://www.google.com/recaptcha/api2/demo")captcha_answer=solver.get_token()new_harvester() Parameters:ParameterRequiredTypeDefaultDescriptionapi_keytrueString-The API Key for the captcha solving sitesolving_sitetrueString (name of site) or int (site ID)"capmonster"The captcha solving site that will be used. Refer tothe site IDssitekeytrueString-Sitekey from the site where captcha is loadedcaptcha_urltrueString-URL where the captcha is locatedcaptcha_typefalseString"v2"Type of captcha you are solving. Either captchaimage,v2,v3,hcaptcha(hcapworks aswell) orhcaptchaturboinvisible_captchafalseboolfalseIf the captcha is invisible or not.This param is only required when solving invisible captchasmin_scorefalsedouble0.7Minimum score for v3 captchas.This param is only required when solving V3 and it needs a higher / lower scoreactionfalseString"verify"Action that is associated with the V3 captcha.This param is only required when solving V3 captchassoft_idfalseint-2captcha Developer ID.Developers get 10% of spendings of their software users.get_token() Parameters:FieldRequiredTypeDescriptionb64_imgfalsestringBase64 encoded captcha imageThis param is only required when solving image captchasproxyfalsestringProxy to be used to solve captchas.This will make the captcha be solved from the proxy ipFormat:ip:port:user:passproxy_typefalsestringType of the proxy being used. Options are:HTTP,HTTPS,SOCKS4,SOCKS5user_agentfalsestringUserAgent that will be passed to the service and used to solve the captcharq_datafalsestringCustom data that is used in some implementations of hCaptcha. Most of the times, you want to set theinvisible_captchaparam totrue.ExamplesExample - V2 Captcha / Basic usagefromcaptchatoolsimportnew_harvesterdefmain():harvester=new_harvester(api_key="CHANGE THIS",solving_site="capsolver",captcha_type="v2",sitekey="6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-",captcha_url="https://www.google.com/recaptcha/api2/demo")answer=harvester.get_token()Example - V3 Captchafromcaptchatoolsimportnew_harvesterdefmain():harvester=new_harvester(api_key="CHANGE THIS",solving_site="capsolver",captcha_type="v3",sitekey="6LcR_okUAAAAAPYrPe-HK_0RULO1aZM15ENyM-Mf",captcha_url="https://antcpt.com/score_detector/",action="homepage",min_score=0.7)token=harvester.get_token()Example - Image captchafromcaptchatoolsimportnew_harvesterdefmain():harvester=new_harvester(api_key="CHANGE THIS",solving_site="capsolver",captcha_type="image",)token=harvester.get_token(b64_img="iVBORw0KGgoAAAANSUhEUgAAAUQAAAAxCAYAAACictAAAAAACXBIWXMAAAsTAAALEwEAmpwYAAAGt0lEQVR4nO1di23bMBC9bKBsIG+QbqBOUHcCa4N4A2uDeIIqGzgTRCNkg2qDaIO6EEABgmDxezz+7gEEglbm8emOj38KgMFgMBgMBoPBYDAYDAaDwWAwGAwGg8FgMBgMhjleAKAFgA4ArgDQi79fAaABgCohDq8rDv2KSyueyQE5+IuSV70TG1eR/1E8w7DEOwDcd9KYiK1GBMQkyX+dBgA4IVY2V15L+QcDDkvevUEFGAzyNklzBQ3pr1x5gfi/WfxuhrHxJfK2RSX4X0VePjWC0pbSgaoKF7Ot+UW+OQR8HQkvjMp70bATWjh8+StXXq8IHEaDOG9FAzsa5m8DSlvaGAkLgG2rNnyZJoFIzQurAs8BJkNI4fDpr1x5dYhcThpcbPK11QhKW1q4EBYA2xZGEMoCkZoXZiWeeyoQmXD49leuvDAF8a4x71ysINaEBfBhC6sC1JHwwq7IsQmHb3/lyqvTiK0l6dj5UvApVhBHwgJg22o18ulEa7hMVldirq/blKeOhNf6+UlUtKvgehRlb8TfsgWcJc2/pRSOOrC/cuW1FcRB/NucxxZzHmeNhZdGwql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iuEMFsTIBLFxDGzZUIUFUV7ZsOcjMf1VAq/nwGI4gwUxMkGsDJ41HepUifYQayQ7Pm5YpvJX7ryeFYtnFGKYrCAeNVZDsVZIKW3prPA9I71kal4/AeAJ8E8ofARadKD2V868niIRw2QF0RaUe+hcbJ0Vw5UnC+HoA/O6i6BvxTzRk6ZAqo5rnZA+muVyHDCkv3Lg1SueP6ySydcGH6Ha5LdNMpGS2aoC28paECuNTyweNs+rhKOJQBDX6UucRunESYSfq3QUQy7Vt3dNKrzPL8iF9FfqvGTDfddkei2aS+oD28paEHVf5qh5CB+TH5YgUgcG9ubuWPyVOi8WRGBB1MHc2v5FEo46Q0GU3chj8jEirMYihL9y4MWCCCyIYBDw345BiD0hHYMgmoihz0WH0P7KgRcLIrAgmgajTQs9IV/b7iqIuld7Yd+HqJoHw/5SHJW/cuHFgggsiKaoRQv7V1NUMC9RxRLEWlzr9Sl6G6YCOVjOibUP7ltc0h/wAwp/5cKrkfB4lEzE+BE6T7b6wLaKRSNe9J/VV+p6sSrbevjmiC+8rPZCvgk+S1r4vAq+qXDK2V+l8GIwGAwGg8FgMBgMBoPBYDAYDAaDwWAwGAwGA/LEf2oS4NVP9R70AAAAAElFTkSuQmCC")Example - Additional captcha datafromcaptchatoolsimportnew_harvesterdefmain():harvester=new_harvester(api_key="CHANGE THIS",solving_site="capsolver",captcha_type="v2",sitekey="6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-",captcha_url="https://www.google.com/recaptcha/api2/demo")token=harvester.get_token(proxy="ip:port:user:pass",proxy_type="http",user_agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36")Supported SitesCapmonster2CaptchaAnticaptchaCapsolverCaptchaAISite-Specific Support:SiteSite IDCaptcha Types  SupportedTask Types SupportedCapmonstercaptchatools.CapmonsterSiteImage captchas,Recaptcha V2,Recaptcha V3,HCaptchaImageToTextTask,NoCaptchaTask,NoCaptchaTaskProxyless,RecaptchaV3TaskProxyless,HCaptchaTaskProxylessAnticaptchacaptchatools.AnticaptchaSiteImage captchas,Recaptcha V2,Recaptcha V3,HCaptchaImageToTextTask,RecaptchaV2TaskRecaptchaV2TaskProxyless,RecaptchaV3TaskProxyless,HCaptchaTaskProxyless2Captchacaptchatools.TwoCaptchaSiteImage captchas,Recaptcha V2,Recaptcha V3,HCaptcha-Capsolvercaptchatools.CapsolverSiteImage captchas,Recaptcha V2,Recaptcha V3,HCaptchaHcaptchaTurbo-CaptchaAIcaptchatools.CaptchaAISiteImage captchas,Recaptcha V2,Recaptcha V3,HCaptcha-RecommendationsFor 2Captcha, don't run more than 60 tasks per API key.Handle errors appropriately.If aErrNoBalanceis thrown, tasks should stop. Some sites will temporarily ban IP's if constant requests come in.ErrorsErrorsReturned WhenErrNoBalanceBalance is below 0 for captcha solving siteErrWrongAPIKeyIncorrect API Key for captcha solving siteErrWrongSitekeyIncorrect sitekeyErrIncorrectCapTypeIncorrectly chose a captcha type. When initializing a new harvester. Refer tothe captcha typesErrNoHarvesterWhen the user did not / incorrectly chose a captcha harvester. Refer to the"how to use" guideError Handlingfromcaptchatoolsimportnew_harvester,exceptionsascaptchaExceptions,defmain():try:harvester=new_harvester()token=harvester.get_token()exceptcaptchaExceptions.NoHarvesterException:print("I need to set my captcha harvester!")Changelog1.4.1What's newAdded CaptchaAIRemoved internal redundant codeFix creating a new harvester if pass in the ID1.3.0What's newGet Balance SupportProxy SupportUser Agent SupportText image captcha supportBetter internal handlingCapsolver supportImportant ChangesIt is recommend to use thenew_harvesterfunction rather than the oldcaptcha_harvesters