Skip to content

Commit 9d99ce1

Browse files
authored
Merge pull request #258 from anubhavanonymous/patch-1
Add email checking functionality for Plurk
2 parents 8c5c2e9 + 5340f40 commit 9d99ce1

1 file changed

Lines changed: 56 additions & 0 deletions

File tree

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import httpx
2+
from user_scanner.core.result import Result
3+
4+
5+
async def _check(email: str) -> Result:
6+
url = "https://www.plurk.com/Users/isEmailFound"
7+
show_url = "https://www.plurk.com"
8+
9+
headers = {
10+
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)",
11+
"Accept": "*/*",
12+
"Accept-Language": "en-US,en;q=0.9",
13+
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
14+
"X-Requested-With": "XMLHttpRequest",
15+
"Origin": "https://www.plurk.com",
16+
}
17+
18+
try:
19+
async with httpx.AsyncClient(timeout=10.0) as client:
20+
response = await client.post(
21+
url,
22+
headers=headers,
23+
data={"email": email}
24+
)
25+
26+
if response.status_code == 403:
27+
return Result.error("Caught by WAF or IP Block (403)")
28+
29+
if response.status_code == 429:
30+
return Result.error("Rate limited (429)")
31+
32+
if response.status_code != 200:
33+
return Result.error(f"HTTP Error: {response.status_code}")
34+
35+
text = response.text.strip()
36+
37+
if text == "True":
38+
return Result.taken(url=show_url)
39+
40+
if text == "False":
41+
return Result.available(url=show_url)
42+
43+
return Result.error("Unexpected response body structure")
44+
45+
except httpx.ConnectTimeout:
46+
return Result.error("Connection timed out")
47+
48+
except httpx.ReadTimeout:
49+
return Result.error("Server took too long to respond")
50+
51+
except Exception as e:
52+
return Result.error(e)
53+
54+
55+
async def validate_plurk(email: str) -> Result:
56+
return await _check(email)

0 commit comments

Comments
 (0)