Skip to content

Commit 8679b19

Browse files
authored
Merge pull request #178 from kaifcodec/add/email-osint-modules
fix(envato.py): 429, 403 error fix with new update
2 parents 6b173d2 + 9aca8e0 commit 8679b19

1 file changed

Lines changed: 30 additions & 23 deletions

File tree

Lines changed: 30 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,48 @@
11
import httpx
22
from user_scanner.core.result import Result
33

4+
45
async def _check(email: str) -> Result:
6+
url = "https://account.envato.com/api/public/validate_email"
7+
58
headers = {
69
'User-Agent': "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36",
7-
'Accept': 'application/json',
8-
'Accept-Language': 'en-US,en;q=0.9',
9-
'Content-Type': 'application/x-www-form-urlencoded',
10-
'Origin': 'https://account.envato.com',
11-
'Referer': 'https://account.envato.com/sign_up',
10+
'Accept': "application/json",
11+
'Content-Type': "application/json",
12+
'x-client-version': "3.6.0",
13+
'origin': "https://elements.envato.com",
14+
'referer': "https://elements.envato.com/",
15+
'accept-language': "en-US,en;q=0.9",
1216
}
1317

14-
payload = {'email': email}
18+
payload = {
19+
"language_code": "en",
20+
"email": email
21+
}
1522

1623
try:
17-
async with httpx.AsyncClient(timeout=10.0) as client:
18-
response = await client.post(
19-
'https://account.envato.com/api/validate_email',
20-
headers=headers,
21-
data=payload
22-
)
23-
24-
if 'Email is already in use' in response.text:
25-
return Result.taken()
26-
27-
if response.status_code == 200:
24+
async with httpx.AsyncClient(timeout=5.0) as client:
25+
response = await client.post(url, json=payload, headers=headers)
26+
27+
if response.status_code == 204:
2828
return Result.available()
29-
30-
if "Page designed by Kotulsky" in response.text or response.status_code == 429:
31-
return Result.error("Rate limit or Cloudflare challenge detected")
32-
33-
return Result.error(f"Unexpected response: {response.status_code}")
29+
30+
if response.status_code == 422:
31+
data = response.json()
32+
error_msg = data.get("error_message", "").lower()
33+
34+
if "already in use" in error_msg:
35+
return Result.taken()
36+
37+
return Result.error("Unexpected response body, report it via GitHub issues")
38+
39+
return Result.error(f"HTTP {response.status_code}")
3440

3541
except httpx.TimeoutException:
3642
return Result.error("Connection timed out")
3743
except Exception as e:
38-
return Result.error(str(e))
44+
return Result.error(f"Unexpected Exception: {e}")
45+
3946

4047
async def validate_envato(email: str) -> Result:
4148
return await _check(email)

0 commit comments

Comments
 (0)