|
| 1 | +import httpx |
| 2 | +from user_scanner.core.result import Result |
| 3 | + |
| 4 | +async def _check(email: str) -> Result: |
| 5 | + url = "https://letsporn.com" |
| 6 | + show_url = "https://letsporn.com" |
| 7 | + |
| 8 | + params = { |
| 9 | + 'mode': "async", |
| 10 | + 'function': "get_block", |
| 11 | + 'block_id': "signup_signup_form_simple", |
| 12 | + 'global': "true" |
| 13 | + } |
| 14 | + |
| 15 | + payload = { |
| 16 | + 'format': "json", |
| 17 | + 'mode': "async", |
| 18 | + 'action': "signup", |
| 19 | + 'email_link': "https://letsporn.com/email", |
| 20 | + 'email': email, |
| 21 | + 'username': email, |
| 22 | + 'pass': "y0u_hav3_th3_s0wrd", |
| 23 | + 'pass2': "but_n0t_th3_cr0wn" |
| 24 | + } |
| 25 | + |
| 26 | + headers = { |
| 27 | + 'User-Agent': "Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Mobile Safari/537.36", |
| 28 | + 'Accept': "application/json, text/plain, */*", |
| 29 | + 'Accept-Encoding': "identity", |
| 30 | + 'sec-ch-ua-platform': '"Android"', |
| 31 | + 'X-Requested-With': "XMLHttpRequest", |
| 32 | + 'Origin': "https://letsporn.com", |
| 33 | + 'Referer': "https://letsporn.com/categories/lesbian", |
| 34 | + } |
| 35 | + |
| 36 | + try: |
| 37 | + async with httpx.AsyncClient(timeout=15.0) as client: |
| 38 | + response = await client.post(url, params=params, data=payload, headers=headers) |
| 39 | + |
| 40 | + if response.status_code == 403: |
| 41 | + return Result.error("403") |
| 42 | + |
| 43 | + data = response.json() |
| 44 | + errors = data.get("errors", []) |
| 45 | + |
| 46 | + for error in errors: |
| 47 | + if isinstance(error, dict): |
| 48 | + code = error.get("code") |
| 49 | + field = error.get("field") |
| 50 | + if code == "exists" and field in ["username", "email"]: |
| 51 | + return Result.taken(url=show_url) |
| 52 | + elif isinstance(error, str): |
| 53 | + msg = error.lower() |
| 54 | + if "already exists" in msg or "already in use" in msg: |
| 55 | + return Result.taken(url=show_url) |
| 56 | + |
| 57 | + return Result.available(url=show_url) |
| 58 | + |
| 59 | + except Exception as e: |
| 60 | + return Result.error(e) |
| 61 | + |
| 62 | +async def validate_letsporn(email: str) -> Result: |
| 63 | + return await _check(email) |
0 commit comments