|
| 1 | +import httpx |
| 2 | +from user_scanner.core.result import Result |
| 3 | + |
| 4 | +async def _check(email: str) -> Result: |
| 5 | + url = "https://thegay.com/api/signup.php" |
| 6 | + show_url = "https://thegay.com" |
| 7 | + |
| 8 | + headers = { |
| 9 | + 'User-Agent': "Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Mobile Safari/537.36", |
| 10 | + 'Accept': "application/json, text/plain, */*", |
| 11 | + 'Accept-Encoding': "identity", |
| 12 | + 'Content-Type': "application/x-www-form-urlencoded", |
| 13 | + 'sec-ch-ua-platform': '"Android"', |
| 14 | + 'Origin': "https://thegay.com", |
| 15 | + 'Referer': "https://thegay.com/signup/", |
| 16 | + 'Priority': "u=1, i" |
| 17 | + } |
| 18 | + |
| 19 | + payload = { |
| 20 | + 'act': "signup", |
| 21 | + 'usr': "th3_knight_l0st", |
| 22 | + 'eml': email, |
| 23 | + 'pwd': "youAr3Al0n3" |
| 24 | + } |
| 25 | + |
| 26 | + try: |
| 27 | + async with httpx.AsyncClient(timeout=10.0) as client: |
| 28 | + response = await client.post(url, data=payload, headers=headers) |
| 29 | + |
| 30 | + if response.status_code == 403: |
| 31 | + return Result.error("Caught by WAF or IP Block (403)") |
| 32 | + |
| 33 | + if response.status_code == 429: |
| 34 | + return Result.error("Rate limited (429)") |
| 35 | + |
| 36 | + if response.status_code != 200: |
| 37 | + return Result.error(f"HTTP Error: {response.status_code}") |
| 38 | + |
| 39 | + data = response.json() |
| 40 | + errors = data.get("errors", []) |
| 41 | + |
| 42 | + # We check if 'eml_occupied' is present in the list of error objects |
| 43 | + is_taken = any(err.get("code") == "eml_occupied" for err in errors) |
| 44 | + |
| 45 | + if is_taken: |
| 46 | + return Result.taken(url=show_url) |
| 47 | + |
| 48 | + # If we get tok_required but NOT eml_occupied, the email is available |
| 49 | + if any(err.get("code") == "tok_required" for err in errors): |
| 50 | + return Result.available(url=show_url) |
| 51 | + |
| 52 | + return Result.error("Unexpected response body structure") |
| 53 | + |
| 54 | + except httpx.ConnectTimeout: |
| 55 | + return Result.error("Connection timed out! maybe region blocks") |
| 56 | + except httpx.ReadTimeout: |
| 57 | + return Result.error("Server took too long to respond (Read Timeout)") |
| 58 | + except Exception as e: |
| 59 | + return Result.error(e) |
| 60 | + |
| 61 | +async def validate_thegay(email: str) -> Result: |
| 62 | + return await _check(email) |
0 commit comments