Skip to content

Commit 90dad61

Browse files
authored
Merge pull request #270 from shredzwho/feature/hackerearth-scanner
Add HackerEarth username scanner module
2 parents 4fb35a3 + 7d92ec2 commit 90dad61

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
from user_scanner.core.orchestrator import status_validate, Result
2+
3+
def validate_hackerearth(user: str) -> Result:
4+
url = f"https://www.hackerearth.com/@{user}"
5+
show_url = url
6+
7+
headers = {
8+
'User-Agent': "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
9+
'Accept': "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",
10+
'Accept-Language': "en-US,en;q=0.5",
11+
'Upgrade-Insecure-Requests': "1",
12+
}
13+
14+
# HackerEarth returns 404 for non-existent users and 200 for existing users.
15+
return status_validate(
16+
url,
17+
available=404,
18+
taken=200,
19+
show_url=show_url,
20+
headers=headers,
21+
follow_redirects=True,
22+
timeout=10.0
23+
)

0 commit comments

Comments
 (0)