Skip to content

Commit 1ba6d2a

Browse files
authored
Merge pull request #129 from atharva7-g/main
feat: add Gumroad username validator.
2 parents 8ef05c4 + 6de3587 commit 1ba6d2a

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import re
2+
from user_scanner.core.orchestrator import status_validate, Result
3+
4+
def validate_gumroad(user: str) -> Result:
5+
if not re.fullmatch(r"[a-z0-9]{3,20}", user):
6+
return Result.error("Username must be between 3 and 20 lowercase alphanumeric characters")
7+
8+
url = f"https://{user}.gumroad.com/"
9+
return status_validate(url, 404, 200, follow_redirects=True)
10+
11+
12+
if __name__ == "__main__":
13+
user = input("Username?: ").strip()
14+
result = validate_gumroad(user)
15+
16+
if result == 1:
17+
print("Available!")
18+
elif result == 0:
19+
print("Unavailable!")
20+
else:
21+
print(f"Error occurred! Reason: {result.get_reason()}")
22+

0 commit comments

Comments
 (0)