Set UserAgent issue with hcaptchas

So i’ve noticed that solving hcaptchas is only possible when using a MacOS useragent, using open bullet to set an osx useragent for the puppeteer worked fine in the past. But now suddenly whenever i click the hcaptcha which used to work perfectly fine, now shows me the hcaptcha solving screen again even when i used the solver and inserted the solution. Now when trying to figure out what causes this i looked into the requests from the web developer tools in chrome. Doing this i saw that while every other request has the correct MacOS useragent, the requests to the hcaptcha site are made with the regular Windows useragent of my computer which i believe is the cause for me suddenly not being able to solve captchas anymore. I have tried to debug this is in every way i could but i have no idea how to stop it from sending my non-modified useragent to the hcaptcha url. Typing navigator.userAgent before and after trying to solve the captcha tells me the MacOS useragent is active. Would really like some help here Im really confused on how to bypass hcaptcha now, as it seems to somehow send my real useragent in the hcaptcha requests even though the useragent is modified in every other request.

You should really provide either some sample code to replicate the issue or at least tell if you’re using puppeteer or normal requests and what you’re writing in the solve hcaptcha block.

I apologize here is the specific piece of code im using to solve the captchas

BLOCK:PuppeteerSetUserAgent
  userAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36"
ENDBLOCK

BLOCK:PuppeteerSetAttributeValue
  findBy = Selector
  identifier = "[name=g-recaptcha-response]"
  attributeName = "style"
  SAFE
ENDBLOCK

BLOCK:SolveHCaptcha
  siteKey = "f5561ba9-8f1e-40ca-9b5b-a0b3f719ef34"
  siteUrl = "https://discord.com/register"
  SAFE
  => VAR @solution
ENDBLOCK

BLOCK:PuppeteerTypeElement
  findBy = Selector
  identifier = "[name=g-recaptcha-response]"
  text = @solution
ENDBLOCK

BLOCK:PuppeteerClick
  findBy = Class
  identifier = "flexCenter-3_1bcw.flex-1O1GKY.justifyCenter-3D2jYp.alignCenter-1dQNNs"
ENDBLOCK

I am using the puppeteer non-headless, this script i have been using for a few weeks now. Before when i ran this it would click the hcaptcha button and then solve the captcha and go to the next part. Now it instead clicks the captcha and shows me a screen that i need to click the images again and solve the captcha. I have had this exact issue before which i then solved by using a MacOS useragent, however now suddenly the issue is appearing again, and using fiddler to view all the http requests shows that specifically for the captcha solving part it is sending the regular windows useragent while for all others the modified MacOS one. I was thinking that possibly hcaptcha implemented some useragent-spoofing detection methods but i’m not sure.

immagine

Change the UA here so the captcha service will use that user agent when asking for the captcha to the website and you will be able to submit it with that user agent. Make sure your captcha solving service supports custom user agents (I know for a fact that 2captcha and anti-captcha support it).

For example if you go here 2captcha API you will see that their API supports sending a userAgent parameter, which should be in fact sent by CaptchaSharp (OB2’s captcha library) and the website will use that UA when requesting a captcha to be solved. Note that you don’t need to use that user agent in a User-Agent header for the request from your pc to the captcha service, because you are talking to 2captcha.com not to the target site, but the captcha service needs to know about it so it can set it when requesting the captcha from the site.

Screenshot 2021-11-19 at 00.34.58
Screenshot 2021-11-19 at 00.35.29
Sadly i tried adding to the User Agent setting the Solve H Captcha block, but it didn’t seem to change anything. Here is a screenshot of 2 requests made with no User Agent changes in between them. The request to the hcaptcha servers is for no discernible reason sent with the non-spoofed useragent of my computer, while any other requests made are done with the spoofed useragent.

Any requests made after that are not to the hcaptcha servers will be sent through the spoofed useragent again, again without me having used any set user agent blocks. It is also before i submit the actual solution. It starts using my non-spoofed useragent the moment i load the captcha.

Also i think I should’ve clarified better that i am able to run the exact same script on my Macbook, where it will work perfect and it will solve the captcha, presumably because it sends the correct useragent to the hcaptcha servers. Is there some way to intercept the requests and modify them so i can change the useragent?

Hmm I don’t know, maybe using an extension to change the user-agent would work. Try to see if you can use extensions, otherwise maybe wait until I add support for them

Thank you i will try that, where do i enable chrome extensions for the puppeteer chrome window?

That’s the thing, I have no clue, I didn’t look into it yet.