gocaptcha
An API wrapper for popular captcha solvers such as AntiCaptcha and 2Captcha in Golang
Installation
Run the following command in your project folder:
go get github.com/justhyped/gocaptcha
Support
Type | 2Captcha | AntiCaptcha | CapMonster Cloud |
---|
RecaptchaV2 | ✅ | ✅ | ✅ |
RecaptchaV3 | ✅ | ✅ | ✅ |
Image Recaptcha | ✅ | ✅ | ✅ |
HCaptcha | ✅ | ✅ | ✅ |
Software like XEVil and CapMonster are also supported, but it gets a little trickier.
Such software runs on a local ip:port so you must specify that with CustomServiceUrl
(don't include the protocol as it defaults to http)
If you intend to use XEVil or CapMonster with this program you should check which API it supports (Either 2Captcha or AntiCaptcha).
Don't forget to add firewall rules and host the captcha software on a public port when using
XEVil or CapMonster between different machines.
Usage
RecaptchaV2
payload := gocaptcha.RecaptchaV2Payload{
EndpointUrl: "https://www.google.com/recaptcha/api2/demo",
EndpointKey: "6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-",
ServiceApiKey: "key",
ServiceName: "2Captcha",
}
captcha, err := gocaptcha.SolveRecaptchaV2(&payload)
These are all supported variables to use in RecaptchaV2Payload:
EndpointUrl string
EndpointKey string
ServiceApiKey string
ServiceName string
IsInvisibleCaptcha bool
CustomServiceUrl string
InitialWaitTime int
PollInterval int
MaxRetries int
RecaptchaV3
payload := gocaptcha.RecaptchaV3Payload{
EndpointUrl: "https://recaptcha-demo.appspot.com/recaptcha-v3-request-scores.php",
EndpointKey: "6LdyC2cUAAAAACGuDKpXeDorzUDWXmdqeg-xy696",
ServiceApiKey: "key",
ServiceName: "2Captcha",
Action: "examples/v3scores",
}
captcha, err := gocaptcha.SolveRecaptchaV3(&payload)
These are all supported variables to use in RecaptchaV3Payload:
EndpointUrl string
EndpointKey string
ServiceApiKey string
ServiceName string
Action string
CustomServiceUrl string
IsEnterprise bool
MinScore float32
InitialWaitTime int
PollInterval int
MaxRetries int
HCaptcha
payload := gocaptcha.HCaptchaPayload{
EndpointUrl: "https://www.hcaptcha.com/",
EndpointKey: "00000000-0000-0000-0000-000000000000",
ServiceApiKey: "key",
ServiceName: "2Captcha",
}
captcha, err := gocaptcha.SolveHCaptcha(&payload)
These are all supported variables to use in HCaptchaPayload:
EndpointUrl string
EndpointKey string
ServiceApiKey string
ServiceName string
CustomServiceUrl string
InitialWaitTime int
PollInterval int
MaxRetries int
Image Captcha
payload := gocaptcha.ImageCaptchaPayload{
ServiceApiKey: "key",
ServiceName: "2Captcha",
Base64String: imageBase64,
}
captcha, err := gocaptcha.SolveImageCaptcha(&payload)
These are all supported variables to use in ImageCaptchaPayload:
Base64String string
ServiceApiKey string
ServiceName string
CustomServiceUrl string
CaseSensitive bool
InstructionsForSolver string
InitialWaitTime int
PollInterval int
MaxRetries int
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
License
MIT