user-scanner 1.0.2.1__py3-none-any.whl → 1.0.9.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. user_scanner/__init__.py +0 -1
  2. user_scanner/__main__.py +114 -61
  3. user_scanner/cli/banner.py +3 -8
  4. user_scanner/cli/printer.py +117 -0
  5. user_scanner/community/__init__.py +1 -0
  6. user_scanner/community/coderlegion.py +11 -31
  7. user_scanner/community/stackoverflow.py +35 -0
  8. user_scanner/core/orchestrator.py +199 -79
  9. user_scanner/core/result.py +128 -0
  10. user_scanner/core/utils.py +9 -0
  11. user_scanner/creator/devto.py +11 -29
  12. user_scanner/creator/hashnode.py +25 -28
  13. user_scanner/creator/itch_io.py +19 -0
  14. user_scanner/creator/kaggle.py +11 -29
  15. user_scanner/creator/medium.py +18 -22
  16. user_scanner/creator/patreon.py +12 -38
  17. user_scanner/creator/producthunt.py +47 -0
  18. user_scanner/dev/codeberg.py +11 -29
  19. user_scanner/dev/cratesio.py +11 -24
  20. user_scanner/dev/dockerhub.py +11 -27
  21. user_scanner/dev/github.py +43 -39
  22. user_scanner/dev/gitlab.py +21 -32
  23. user_scanner/dev/huggingface.py +19 -0
  24. user_scanner/dev/launchpad.py +11 -24
  25. user_scanner/dev/npmjs.py +21 -34
  26. user_scanner/dev/replit.py +11 -29
  27. user_scanner/donation/__init__.py +0 -0
  28. user_scanner/donation/buymeacoffee.py +19 -0
  29. user_scanner/donation/liberapay.py +36 -0
  30. user_scanner/gaming/chess_com.py +20 -36
  31. user_scanner/gaming/minecraft.py +19 -0
  32. user_scanner/gaming/monkeytype.py +8 -26
  33. user_scanner/gaming/osu.py +13 -38
  34. user_scanner/gaming/roblox.py +37 -42
  35. user_scanner/gaming/steam.py +29 -0
  36. user_scanner/social/bluesky.py +21 -38
  37. user_scanner/social/discord.py +17 -21
  38. user_scanner/social/instagram.py +11 -24
  39. user_scanner/social/mastodon.py +12 -38
  40. user_scanner/social/pinterest.py +18 -32
  41. user_scanner/social/reddit.py +19 -32
  42. user_scanner/social/snapchat.py +24 -37
  43. user_scanner/social/soundcloud.py +43 -0
  44. user_scanner/social/telegram.py +19 -24
  45. user_scanner/social/threads.py +11 -24
  46. user_scanner/social/x.py +20 -28
  47. user_scanner/social/youtube.py +41 -47
  48. user_scanner/utils/version.py +2 -0
  49. user_scanner/version.json +1 -1
  50. {user_scanner-1.0.2.1.dist-info → user_scanner-1.0.9.0.dist-info}/METADATA +62 -67
  51. user_scanner-1.0.9.0.dist-info/RECORD +61 -0
  52. user_scanner-1.0.2.1.dist-info/RECORD +0 -48
  53. {user_scanner-1.0.2.1.dist-info → user_scanner-1.0.9.0.dist-info}/WHEEL +0 -0
  54. {user_scanner-1.0.2.1.dist-info → user_scanner-1.0.9.0.dist-info}/entry_points.txt +0 -0
  55. {user_scanner-1.0.2.1.dist-info → user_scanner-1.0.9.0.dist-info}/licenses/LICENSE +0 -0
@@ -1,6 +1,6 @@
1
- import httpx
2
- from httpx import ConnectError, TimeoutException
3
- import json
1
+ from user_scanner.core.orchestrator import generic_validate
2
+ from user_scanner.core.result import Result
3
+
4
4
 
5
5
  def validate_chess_com(user):
6
6
  url = f"https://www.chess.com/callback/user/valid?username={user}"
@@ -12,43 +12,27 @@ def validate_chess_com(user):
12
12
  'Accept-Language': "en-US,en;q=0.9",
13
13
  }
14
14
 
15
- try:
16
- response = httpx.get(url, headers=headers, timeout = 3.0)
17
- status = response.status_code
18
-
19
- if status == 200:
15
+ def process(response):
16
+ if response.status_code == 200:
20
17
  data = response.json()
21
18
  if data.get('valid') is True:
22
19
  # 'valid': true means the username is NOT taken
23
- return 1
20
+ return Result.available()
24
21
  elif data.get('valid') is False:
25
22
  # 'valid': false means the username IS taken
26
- return 0
27
- else:
28
- return 2
29
- else:
30
- return 2
31
-
32
- except (ConnectError, TimeoutException):
33
- return 2
34
- except json.JSONDecodeError:
35
- return 2
36
- except Exception:
37
- return 2
23
+ return Result.taken()
24
+ return Result.error("Invalid status code")
25
+
26
+ return generic_validate(url, process, headers=headers)
27
+
38
28
 
39
29
  if __name__ == "__main__":
40
- try:
41
- import httpx
42
- except ImportError:
43
- print("Error: 'httpx' library is not installed.")
44
- exit()
45
-
46
- user = input ("Username?: ").strip()
47
- result = validate_chess_com(user)
48
-
49
- if result == 1:
50
- print("Available!")
51
- elif result == 0:
52
- print("Unavailable!")
53
- else:
54
- print("Error occured!")
30
+ user = input("Username?: ").strip()
31
+ result = validate_chess_com(user)
32
+
33
+ if result == 1:
34
+ print("Available!")
35
+ elif result == 0:
36
+ print("Unavailable!")
37
+ else:
38
+ print("Error occured!")
@@ -0,0 +1,19 @@
1
+ from user_scanner.core.orchestrator import status_validate
2
+
3
+
4
+ def validate_minecraft(user):
5
+ url = f"https://api.mojang.com/minecraft/profile/lookup/name/{user}"
6
+
7
+ return status_validate(url, 404, 200, follow_redirects=True)
8
+
9
+
10
+ if __name__ == "__main__":
11
+ user = input("Username?: ").strip()
12
+ result = validate_minecraft(user)
13
+
14
+ if result == 1:
15
+ print("Available!")
16
+ elif result == 0:
17
+ print("Unavailable!")
18
+ else:
19
+ print("Error occurred!")
@@ -1,6 +1,5 @@
1
- import httpx
2
- from httpx import ConnectError, TimeoutException
3
- import json
1
+ from user_scanner.core.orchestrator import generic_validate
2
+ from user_scanner.core.result import Result
4
3
 
5
4
  def validate_monkeytype(user: str) -> int:
6
5
 
@@ -17,11 +16,8 @@ def validate_monkeytype(user: str) -> int:
17
16
  "Accept-Language": "en-US,en;q=0.9",
18
17
  }
19
18
 
20
- try:
21
- response = httpx.get(url, headers=headers, timeout=3.0)
22
- status = response.status_code
23
-
24
- if status == 200:
19
+ def process(response):
20
+ if response.status_code == 200:
25
21
  data = response.json()
26
22
  # Expected shape:
27
23
  # { "message": "string", "data": { "available": true/false } }
@@ -29,29 +25,15 @@ def validate_monkeytype(user: str) -> int:
29
25
  available = payload.get("available")
30
26
 
31
27
  if available is True:
32
- return 1
28
+ return Result.available()
33
29
  elif available is False:
34
- return 0
35
- else:
36
- return 2
37
- else:
38
- return 2
30
+ return Result.taken()
31
+ return Result.error("Invalid status code")
39
32
 
40
- except (ConnectError, TimeoutException):
41
- return 2
42
- except json.JSONDecodeError:
43
- return 2
44
- except Exception:
45
- return 2
33
+ return generic_validate(url, process, headers=headers)
46
34
 
47
35
 
48
36
  if __name__ == "__main__":
49
- try:
50
- import httpx # noqa: F401
51
- except ImportError:
52
- print("Error: 'httpx' library is not installed.")
53
- raise SystemExit(1)
54
-
55
37
  user = input("Username?: ").strip()
56
38
  result = validate_monkeytype(user)
57
39
 
@@ -1,44 +1,19 @@
1
- import httpx
2
- from httpx import ConnectError, TimeoutException
1
+ from user_scanner.core.orchestrator import status_validate
2
+
3
3
 
4
4
  def validate_osu(user):
5
- """
6
- Checks if a Osu username is available.
7
- Returns: 1 -> available, 0 -> taken, 2 -> error
8
- """
9
-
10
5
  url = f"https://osu.ppy.sh/users/{user}"
11
-
12
- headers = {
13
- 'User-Agent': "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36",
14
- 'Accept': "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
15
- 'Accept-Encoding': "gzip, deflate, br",
16
- 'Accept-Language': "en-US,en;q=0.9",
17
- 'sec-fetch-dest': "document",
18
- }
19
-
20
- try:
21
- response = httpx.get(url, headers = headers, timeout = 5.0, follow_redirects = True)
22
- status = response.status_code
23
-
24
- if status == 200:
25
- return 0
26
- elif status == 404:
27
- return 1
28
- else:
29
- return 2
30
- except (ConnectError, TimeoutException):
31
- return 2
32
- except Exception:
33
- return 2
6
+
7
+ return status_validate(url, 404, [200, 302], follow_redirects=True)
8
+
34
9
 
35
10
  if __name__ == "__main__":
36
- user = input ("Username?: ").strip()
37
- result = validate_osu(user)
11
+ user = input("Username?: ").strip()
12
+ result = validate_osu(user)
38
13
 
39
- if result == 1:
40
- print("Available!")
41
- elif result == 0:
42
- print("Unavailable!")
43
- else:
44
- print("Error occurred!")
14
+ if result == 1:
15
+ print("Available!")
16
+ elif result == 0:
17
+ print("Unavailable!")
18
+ else:
19
+ print("Error occurred!")
@@ -1,48 +1,43 @@
1
- import httpx
2
- from httpx import ConnectError, TimeoutException
1
+ from user_scanner.core.orchestrator import generic_validate
2
+ from user_scanner.core.result import Result
3
+
3
4
 
4
5
  def validate_roblox(user):
5
- """
6
- Checks if a roblox username is available.
7
- Returns: 1 -> available, 0 -> taken, 2 -> error
8
- """
9
-
10
- url = f"https://users.roblox.com/v1/users/search?keyword={user}&limit=10" # official api
11
-
12
- headers = {
13
- 'User-Agent': "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36",
14
- 'Accept': "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
15
- 'Accept-Encoding': "gzip, deflate, br",
16
- 'Accept-Language': "en-US,en;q=0.9",
17
- 'sec-fetch-dest': "document",
18
- }
19
-
20
- try:
21
- response = httpx.get(url, headers = headers, timeout = 5.5, follow_redirects = True)
22
- status = response.status_code
23
- search_results = response.json() # api response
24
-
25
- if "errors" in search_results: # this usually triggers when timeout or ratelimit
26
- return 2
27
-
28
- for entry in search_results["data"]: # iterates through the entries in the search results
6
+ # official api
7
+ url = f"https://users.roblox.com/v1/users/search?keyword={user}&limit=10"
8
+
9
+ def process(response):
10
+ search_results = response.json() # api response
11
+
12
+ if response.status_code == 429:
13
+ return Result.error("Too many requests")
14
+
15
+ if response.status_code == 400:
16
+ error = search_results["errors"][0] #Api states theres always an error
17
+ if error["code"] == 6:
18
+ return Result.error("Username is too short")
19
+ if error["code"] == 5:
20
+ return Result.error("Username was filtered")
21
+ #Shouldn't be able to reach this
22
+ return Result.error("Invalid username")
23
+
24
+ # iterates through the entries in the search results
25
+ for entry in search_results["data"]:
29
26
  # .lower() so casing from the API doesn't matter
30
- if entry["name"].lower() == user.lower(): # if a username matches the user
31
- return 0
32
- return 1
27
+ if entry["name"].lower() == user.lower(): # if a username matches the user
28
+ return Result.taken()
29
+ return Result.available()
30
+
31
+ return generic_validate(url, process, follow_redirects=True)
33
32
 
34
- except (ConnectError, TimeoutException):
35
- return 2
36
- except Exception as e:
37
- return 2
38
33
 
39
34
  if __name__ == "__main__":
40
- user = input ("Username?: ").strip()
41
- result = validate_roblox(user)
42
-
43
- if result == 1:
44
- print("Available!")
45
- elif result == 0:
46
- print("Unavailable!")
47
- else:
48
- print("Error occurred!")
35
+ user = input("Username?: ").strip()
36
+ result = validate_roblox(user)
37
+
38
+ if result == 1:
39
+ print("Available!")
40
+ elif result == 0:
41
+ print("Unavailable!")
42
+ else:
43
+ print("Error occurred!")
@@ -0,0 +1,29 @@
1
+ from user_scanner.core.orchestrator import generic_validate
2
+ from user_scanner.core.result import Result
3
+
4
+
5
+ def validate_steam(user):
6
+ url = f"https://steamcommunity.com/id/{user}/"
7
+
8
+ def process(response):
9
+ if response.status_code == 200:
10
+ if "Error</title>" in response.text:
11
+ return Result.available()
12
+ else:
13
+ return Result.taken()
14
+
15
+ return Result.error("Invalid status code")
16
+
17
+ return generic_validate(url, process)
18
+
19
+
20
+ if __name__ == "__main__":
21
+ user = input("Username?: ").strip()
22
+ result = validate_steam(user)
23
+
24
+ if result == 1:
25
+ print("Available!")
26
+ elif result == 0:
27
+ print("Unavailable!")
28
+ else:
29
+ print("Error occurred!")
@@ -1,7 +1,6 @@
1
- import httpx
2
- from httpx import ConnectError, TimeoutException
3
- import re
4
- import json
1
+ from user_scanner.core.orchestrator import generic_validate
2
+ from user_scanner.core.result import Result
3
+
5
4
 
6
5
  def validate_bluesky(user):
7
6
  handle = user if user.endswith('.bsky.social') else f"{user}.bsky.social"
@@ -26,46 +25,30 @@ def validate_bluesky(user):
26
25
  'handle': handle,
27
26
  }
28
27
 
29
- if not re.fullmatch(r"^[a-zA-Z0-9\.-]{1,64}$", user):
30
- return 2
31
-
32
- try:
33
- response = httpx.get(url, headers=headers, params=params, timeout = 15.0)
34
- status = response.status_code
35
-
36
- if status == 200:
28
+ def process(response):
29
+ if response.status_code == 200:
37
30
  data = response.json()
38
31
  result_type = data.get('result', {}).get('$type')
39
32
 
40
33
  if result_type == "com.atproto.temp.checkHandleAvailability#resultAvailable":
41
- return 1
34
+ return Result.available()
42
35
  elif result_type == "com.atproto.temp.checkHandleAvailability#resultUnavailable":
43
- return 0
44
- else:
45
- return 2
46
- else:
47
- return 2
36
+ return Result.taken()
37
+ elif response.status_code == 400:
38
+ return Result.error("Username can only contain letters, numbers, hyphens (no leading/trailing)")
48
39
 
49
- except (ConnectError, TimeoutException):
50
- return 2
51
- except json.JSONDecodeError:
52
- return 2
53
- except Exception:
54
- return 2
40
+ return Result.error("Invalid status code!")
55
41
 
56
- if __name__ == "__main__":
57
- try:
58
- import httpx
59
- except ImportError:
60
- print("Error: 'httpx' library is not installed.")
61
- exit()
42
+ return generic_validate(url, process, headers=headers, params=params, timeout=15.0)
62
43
 
63
- user = input ("Username?: ").strip()
64
- result = validate_bluesky(user)
65
44
 
66
- if result == 1:
67
- print("Available!")
68
- elif result == 0:
69
- print("Unavailable!")
70
- else:
71
- print("Error occured!")
45
+ if __name__ == "__main__":
46
+ user = input("Username?: ").strip()
47
+ result = validate_bluesky(user)
48
+
49
+ if result == 1:
50
+ print("Available!")
51
+ elif result == 0:
52
+ print("Unavailable!")
53
+ else:
54
+ print("Error occured!")
@@ -1,5 +1,5 @@
1
1
  import httpx
2
- from httpx import ConnectError, TimeoutException
2
+ from user_scanner.core.result import Result
3
3
 
4
4
  def validate_discord(user):
5
5
  url = "https://discord.com/api/v9/unique-username/username-attempt-unauthed"
@@ -12,33 +12,29 @@ def validate_discord(user):
12
12
  "origin": "https://discord.com",
13
13
  "referer": "https://discord.com/register"
14
14
  }
15
-
15
+
16
16
  data = {"username": user}
17
-
17
+
18
18
  try:
19
19
  response = httpx.post(url, headers=headers, json=data, timeout=3.0)
20
20
  if response.status_code == 200:
21
21
  status = response.json().get("taken")
22
22
  if status is True:
23
- return 0
23
+ return Result.taken()
24
24
  elif status is False:
25
- return 1
26
- return 2
27
- except (ConnectError, TimeoutException):
28
- return 2
29
- except Exception:
30
- return 2
31
-
32
- if __name__ == "__main__":
33
- user = input ("Username?: ").strip()
34
- result = validate_discord(user)
35
-
36
- if result == 1:
37
- print("Available!")
38
- elif result == 0:
39
- print("Unavailable!")
40
- else:
41
- print("Error occured!")
25
+ return Result.available()
26
+ return Result.error("Invalid status code")
27
+ except Exception as e:
28
+ return Result.error(e)
42
29
 
43
30
 
31
+ if __name__ == "__main__":
32
+ user = input("Username?: ").strip()
33
+ result = validate_discord(user)
44
34
 
35
+ if result == 1:
36
+ print("Available!")
37
+ elif result == 0:
38
+ print("Unavailable!")
39
+ else:
40
+ print("Error occured!")
@@ -1,5 +1,5 @@
1
- import httpx
2
- from httpx import ConnectError, TimeoutException
1
+ from user_scanner.core.orchestrator import status_validate
2
+
3
3
 
4
4
  def validate_instagram(user):
5
5
  url = f"https://www.instagram.com/api/v1/users/web_profile_info/?username={user}"
@@ -14,29 +14,16 @@ def validate_instagram(user):
14
14
  'Referer': f"https://www.instagram.com/{user}/",
15
15
  }
16
16
 
17
- try:
18
- response = httpx.get(url, headers=headers, timeout = 3.0)
19
- status = response.status_code
20
-
21
- if status == 200:
22
- return 0
23
- elif status == 404:
24
- return 1
25
- else:
26
- return 2
17
+ return status_validate(url, 404, 200, headers=headers)
27
18
 
28
- except (ConnectError, TimeoutException):
29
- return 2
30
- except Exception:
31
- return 2
32
19
 
33
20
  if __name__ == "__main__":
34
- user = input ("Username?: ").strip()
35
- result = validate_instagram(user)
21
+ user = input("Username?: ").strip()
22
+ result = validate_instagram(user)
36
23
 
37
- if result == 1:
38
- print("Available!")
39
- elif result == 0:
40
- print("Unavailable!")
41
- else:
42
- print("Error occured!")
24
+ if result == 1:
25
+ print("Available!")
26
+ elif result == 0:
27
+ print("Unavailable!")
28
+ else:
29
+ print("Error occured!")
@@ -1,45 +1,19 @@
1
- import httpx
2
- from httpx import ConnectError, TimeoutException
1
+ from user_scanner.core.orchestrator import status_validate
2
+
3
3
 
4
4
  def validate_mastodon(user):
5
5
  url = f"https://mastodon.social/@{user}"
6
6
 
7
- headers = {
8
- 'User-Agent': "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36",
9
- 'Accept': "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
10
- 'Accept-Encoding': "gzip, deflate, br",
11
- 'Accept-Language': "en-US,en;q=0.9",
12
- }
13
-
14
- try:
15
- response = httpx.get(url, headers=headers, timeout = 3.0, follow_redirects=True)
16
- status = response.status_code
17
-
18
- if status == 200:
19
- return 0
20
- elif status == 404:
21
- return 1
22
- else:
23
- return 2
7
+ return status_validate(url, 404, 200, follow_redirects=True)
24
8
 
25
- except (ConnectError, TimeoutException):
26
- return 2
27
- except Exception:
28
- return 2
29
9
 
30
10
  if __name__ == "__main__":
31
- try:
32
- import httpx
33
- except ImportError:
34
- print("Error: 'httpx' library is not installed.")
35
- exit()
36
-
37
- user = input ("Username?: ").strip()
38
- result = validate_mastodon(user)
39
-
40
- if result == 1:
41
- print("Available!")
42
- elif result == 0:
43
- print("Unavailable!")
44
- else:
45
- print("Error occured!")
11
+ user = input("Username?: ").strip()
12
+ result = validate_mastodon(user)
13
+
14
+ if result == 1:
15
+ print("Available!")
16
+ elif result == 0:
17
+ print("Unavailable!")
18
+ else:
19
+ print("Error occured!")
@@ -1,42 +1,28 @@
1
- import httpx
2
- from httpx import ConnectError, TimeoutException
1
+ from user_scanner.core.orchestrator import generic_validate
2
+ from user_scanner.core.result import Result
3
3
 
4
4
  def validate_pinterest(user):
5
5
  url = f"https://www.pinterest.com/{user}/"
6
6
 
7
- headers = {
8
- 'User-Agent': "Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Mobile Safari/537.36",
9
- 'Accept': "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
10
- 'Accept-Encoding': "gzip",
11
- 'Accept-Language': "en-US,en;q=0.9",
12
- 'sec-fetch-dest': "document",
13
- }
14
-
15
- NOT_FOUND_STRING = "User not found."
16
-
17
- try:
18
- response = httpx.get(url, headers=headers, follow_redirects=True, timeout = 3.0)
19
-
7
+ def process(response):
20
8
  if response.status_code == 200:
21
- if NOT_FOUND_STRING in response.text:
22
- return 1
9
+ if "User not found." in response.text:
10
+ return Result.available()
23
11
  else:
24
- return 0
12
+ return Result.taken()
25
13
  else:
26
- return 2
14
+ return Result.error("Invalid status code")
27
15
 
28
- except (ConnectError, TimeoutException):
29
- return 2
30
- except Exception:
31
- return 2
16
+ return generic_validate(url, process, follow_redirects=True)
32
17
 
33
- if __name__ == "__main__":
34
- user = input ("Username?: ").strip()
35
- result = validate_pinterest(user)
36
18
 
37
- if result == 1:
38
- print("Available!")
39
- elif result == 0:
40
- print("Unavailable!")
41
- else:
42
- print("Error occured!")
19
+ if __name__ == "__main__":
20
+ user = input("Username?: ").strip()
21
+ result = validate_pinterest(user)
22
+
23
+ if result == 1:
24
+ print("Available!")
25
+ elif result == 0:
26
+ print("Unavailable!")
27
+ else:
28
+ print("Error occured!")