Skip to content

Commit 30766b5

Browse files
Merge pull request #313 from kaifcodec/fix/email-osint-modules
fix(pornhub): properly handle invalid email domains and refine error handling logic
2 parents b4d77ab + a03fbc5 commit 30766b5

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

user_scanner/email_scan/adult/pornhub.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,20 @@ async def _check(email: str) -> Result:
4949
data = response.json()
5050
status = data.get("email")
5151
error_msg = data.get("error_message", "")
52+
email_dom = email.split("@")[-1]
53+
54+
if status == "create_account_failed":
55+
if "Email extension" in error_msg:
56+
return Result.available(url=show_url, reason=f"Domain '{email_dom}' is not allowed by PornHub")
57+
if "delivery issues" in error_msg:
58+
return Result.error(url=show_url, reason="The email is experiencing email delivery issues")
5259

5360
if status == "create_account_passed":
5461
return Result.available(url=show_url)
55-
elif "already in use" in error_msg.lower() or status != "create_account_passed":
62+
elif "already in use" in error_msg.lower() or "already registered" in error_msg:
5663
return Result.taken(url=show_url)
5764
else:
58-
return Result.error(f"Unexpected API response: {status}")
65+
return Result.error(f"Unexpected API response: {status}: {error_msg}")
5966

6067
except Exception as e:
6168
return Result.error(e)

0 commit comments

Comments
 (0)