Skip to content

Commit 095422a

Browse files
committed
new: Extract hcaptcha
1 parent 7330b84 commit 095422a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

har2tree/helper.py

+10
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,16 @@ def find_identifiers(html_doc: bytes) -> dict[str, list[str]] | None:
274274
to_return['recaptcha'] += sitekey
275275
else:
276276
to_return['recaptcha'].append(sitekey)
277+
278+
if recaptchas := soup.select(".h-captcha"):
279+
# We should have only one recaptcha per page, but have you seen the web?
280+
for recaptcha in recaptchas:
281+
if sitekey := recaptcha.get('data-sitekey'):
282+
if isinstance(sitekey, list):
283+
# Should not happen, but once again...
284+
to_return['hcaptcha'] += sitekey
285+
else:
286+
to_return['hcaptcha'].append(sitekey)
277287
return to_return
278288

279289

0 commit comments

Comments
 (0)