user-scanner 1.0.4.2__py3-none-any.whl → 1.0.6.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 (48) hide show
  1. user_scanner/__init__.py +0 -1
  2. user_scanner/__main__.py +24 -17
  3. user_scanner/cli/banner.py +2 -0
  4. user_scanner/community/coderlegion.py +11 -31
  5. user_scanner/core/orchestrator.py +72 -15
  6. user_scanner/creator/devto.py +11 -29
  7. user_scanner/creator/hashnode.py +19 -17
  8. user_scanner/creator/itch_io.py +12 -33
  9. user_scanner/creator/kaggle.py +11 -29
  10. user_scanner/creator/medium.py +11 -10
  11. user_scanner/creator/patreon.py +18 -38
  12. user_scanner/creator/producthunt.py +16 -14
  13. user_scanner/dev/codeberg.py +11 -29
  14. user_scanner/dev/cratesio.py +11 -24
  15. user_scanner/dev/dockerhub.py +11 -27
  16. user_scanner/dev/github.py +23 -36
  17. user_scanner/dev/gitlab.py +18 -30
  18. user_scanner/dev/launchpad.py +11 -24
  19. user_scanner/dev/npmjs.py +22 -19
  20. user_scanner/dev/replit.py +11 -29
  21. user_scanner/donation/__init__.py +0 -0
  22. user_scanner/donation/buymeacoffee.py +22 -0
  23. user_scanner/donation/liberapay.py +36 -0
  24. user_scanner/gaming/chess_com.py +23 -34
  25. user_scanner/gaming/minecraft.py +24 -0
  26. user_scanner/gaming/monkeytype.py +6 -18
  27. user_scanner/gaming/osu.py +14 -34
  28. user_scanner/gaming/roblox.py +21 -31
  29. user_scanner/gaming/steam.py +15 -29
  30. user_scanner/social/bluesky.py +21 -32
  31. user_scanner/social/discord.py +12 -13
  32. user_scanner/social/instagram.py +11 -24
  33. user_scanner/social/mastodon.py +18 -38
  34. user_scanner/social/pinterest.py +16 -30
  35. user_scanner/social/reddit.py +16 -30
  36. user_scanner/social/snapchat.py +24 -37
  37. user_scanner/social/telegram.py +13 -18
  38. user_scanner/social/threads.py +11 -24
  39. user_scanner/social/x.py +14 -12
  40. user_scanner/social/youtube.py +37 -34
  41. user_scanner/utils/version.py +2 -0
  42. user_scanner/version.json +1 -1
  43. {user_scanner-1.0.4.2.dist-info → user_scanner-1.0.6.0.dist-info}/METADATA +12 -53
  44. user_scanner-1.0.6.0.dist-info/RECORD +55 -0
  45. user_scanner-1.0.4.2.dist-info/RECORD +0 -51
  46. {user_scanner-1.0.4.2.dist-info → user_scanner-1.0.6.0.dist-info}/WHEEL +0 -0
  47. {user_scanner-1.0.4.2.dist-info → user_scanner-1.0.6.0.dist-info}/entry_points.txt +0 -0
  48. {user_scanner-1.0.4.2.dist-info → user_scanner-1.0.6.0.dist-info}/licenses/LICENSE +0 -0
@@ -1,44 +1,24 @@
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
5
  """
6
6
  Checks if a Osu username is available.
7
7
  Returns: 1 -> available, 0 -> taken, 2 -> error
8
8
  """
9
-
9
+
10
10
  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
11
+
12
+ return status_validate(url, 404, [200, 302], follow_redirects=True)
13
+
34
14
 
35
15
  if __name__ == "__main__":
36
- user = input ("Username?: ").strip()
37
- result = validate_osu(user)
16
+ user = input("Username?: ").strip()
17
+ result = validate_osu(user)
38
18
 
39
- if result == 1:
40
- print("Available!")
41
- elif result == 0:
42
- print("Unavailable!")
43
- else:
44
- print("Error occurred!")
19
+ if result == 1:
20
+ print("Available!")
21
+ elif result == 0:
22
+ print("Unavailable!")
23
+ else:
24
+ print("Error occurred!")
@@ -1,5 +1,5 @@
1
- import httpx
2
- from httpx import ConnectError, TimeoutException
1
+ from user_scanner.core.orchestrator import generic_validate
2
+
3
3
 
4
4
  def validate_roblox(user):
5
5
  """
@@ -7,42 +7,32 @@ def validate_roblox(user):
7
7
  Returns: 1 -> available, 0 -> taken, 2 -> error
8
8
  """
9
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
- }
10
+ # official api
11
+ url = f"https://users.roblox.com/v1/users/search?keyword={user}&limit=10"
19
12
 
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
13
+ def process(response):
14
+ search_results = response.json() # api response
24
15
 
25
- if "errors" in search_results: # this usually triggers when timeout or ratelimit
16
+ if "errors" in search_results: # this usually triggers when timeout or ratelimit
26
17
  return 2
27
18
 
28
- for entry in search_results["data"]: # iterates through the entries in the search results
19
+ # iterates through the entries in the search results
20
+ for entry in search_results["data"]:
29
21
  # .lower() so casing from the API doesn't matter
30
- if entry["name"].lower() == user.lower(): # if a username matches the user
22
+ if entry["name"].lower() == user.lower(): # if a username matches the user
31
23
  return 0
32
24
  return 1
33
25
 
34
- except (ConnectError, TimeoutException):
35
- return 2
36
- except Exception as e:
37
- return 2
26
+ return generic_validate(url, process, follow_redirects=True)
27
+
38
28
 
39
29
  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!")
30
+ user = input("Username?: ").strip()
31
+ result = validate_roblox(user)
32
+
33
+ if result == 1:
34
+ print("Available!")
35
+ elif result == 0:
36
+ print("Unavailable!")
37
+ else:
38
+ print("Error occurred!")
@@ -1,5 +1,5 @@
1
- import httpx
2
- from httpx import ConnectError, TimeoutException
1
+ from user_scanner.core.orchestrator import generic_validate
2
+
3
3
 
4
4
  def validate_steam(user):
5
5
  """
@@ -9,38 +9,24 @@ def validate_steam(user):
9
9
 
10
10
  url = f"https://steamcommunity.com/id/{user}/"
11
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)
22
-
12
+ def process(response):
23
13
  if response.status_code == 200:
24
-
25
14
  if response.text.find("Error</title>") != -1:
26
15
  return 1
27
16
  else:
28
17
  return 0
29
-
30
- return 2
31
-
32
- except (ConnectError, TimeoutException):
33
- return 2
34
- except Exception as e:
35
18
  return 2
36
19
 
20
+ return generic_validate(url, process)
21
+
22
+
37
23
  if __name__ == "__main__":
38
- user = input ("Username?: ").strip()
39
- result = validate_steam(user)
40
-
41
- if result == 1:
42
- print("Available!")
43
- elif result == 0:
44
- print("Unavailable!")
45
- else:
46
- print("Error occurred!")
24
+ user = input("Username?: ").strip()
25
+ result = validate_steam(user)
26
+
27
+ if result == 1:
28
+ print("Available!")
29
+ elif result == 0:
30
+ print("Unavailable!")
31
+ else:
32
+ print("Error occurred!")
@@ -1,7 +1,6 @@
1
- import httpx
2
- from httpx import ConnectError, TimeoutException
3
1
  import re
4
- import json
2
+ from user_scanner.core.orchestrator import generic_validate
3
+
5
4
 
6
5
  def validate_bluesky(user):
7
6
  handle = user if user.endswith('.bsky.social') else f"{user}.bsky.social"
@@ -29,11 +28,8 @@ def validate_bluesky(user):
29
28
  if not re.fullmatch(r"^[a-zA-Z0-9\.-]{1,64}$", user):
30
29
  return 2
31
30
 
32
- try:
33
- response = httpx.get(url, headers=headers, params=params, timeout = 15.0)
34
- status = response.status_code
35
-
36
- if status == 200:
31
+ def process(response):
32
+ if response.status_code == 200:
37
33
  data = response.json()
38
34
  result_type = data.get('result', {}).get('$type')
39
35
 
@@ -41,31 +37,24 @@ def validate_bluesky(user):
41
37
  return 1
42
38
  elif result_type == "com.atproto.temp.checkHandleAvailability#resultUnavailable":
43
39
  return 0
44
- else:
45
- return 2
46
- else:
47
- return 2
48
-
49
- except (ConnectError, TimeoutException):
50
- return 2
51
- except json.JSONDecodeError:
52
- return 2
53
- except Exception:
54
40
  return 2
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
+ try:
47
+ import httpx
48
+ except ImportError:
49
+ print("Error: 'httpx' library is not installed.")
50
+ exit()
51
+
52
+ user = input("Username?: ").strip()
53
+ result = validate_bluesky(user)
54
+
55
+ if result == 1:
56
+ print("Available!")
57
+ elif result == 0:
58
+ print("Unavailable!")
59
+ else:
60
+ print("Error occured!")
@@ -1,6 +1,7 @@
1
1
  import httpx
2
2
  from httpx import ConnectError, TimeoutException
3
3
 
4
+
4
5
  def validate_discord(user):
5
6
  url = "https://discord.com/api/v9/unique-username/username-attempt-unauthed"
6
7
 
@@ -12,9 +13,9 @@ def validate_discord(user):
12
13
  "origin": "https://discord.com",
13
14
  "referer": "https://discord.com/register"
14
15
  }
15
-
16
+
16
17
  data = {"username": user}
17
-
18
+
18
19
  try:
19
20
  response = httpx.post(url, headers=headers, json=data, timeout=3.0)
20
21
  if response.status_code == 200:
@@ -29,16 +30,14 @@ def validate_discord(user):
29
30
  except Exception:
30
31
  return 2
31
32
 
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!")
42
-
43
33
 
34
+ if __name__ == "__main__":
35
+ user = input("Username?: ").strip()
36
+ result = validate_discord(user)
44
37
 
38
+ if result == 1:
39
+ print("Available!")
40
+ elif result == 0:
41
+ print("Unavailable!")
42
+ else:
43
+ 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,25 @@
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
+ try:
12
+ import httpx
13
+ except ImportError:
14
+ print("Error: 'httpx' library is not installed.")
15
+ exit()
16
+
17
+ user = input("Username?: ").strip()
18
+ result = validate_mastodon(user)
19
+
20
+ if result == 1:
21
+ print("Available!")
22
+ elif result == 0:
23
+ print("Unavailable!")
24
+ else:
25
+ 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
+
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:
9
+ if "User not found." in response.text:
22
10
  return 1
23
11
  else:
24
12
  return 0
25
13
  else:
26
- return 2
14
+ return 2
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!")
@@ -1,42 +1,28 @@
1
- import httpx
2
- from httpx import ConnectError, TimeoutException
1
+ from user_scanner.core.orchestrator import generic_validate
2
+
3
3
 
4
4
  def validate_reddit(user):
5
5
  url = f"https://www.reddit.com/user/{user}/"
6
6
 
7
- headers = {
8
- 'User-Agent': "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36",
9
- 'Accept': "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
10
- 'Accept-Encoding': "gzip, deflate, br",
11
- 'Accept-Language': "en-US,en;q=0.9",
12
- 'sec-fetch-dest': "document",
13
- }
14
-
15
- NOT_FOUND_STRING = "Sorry, nobody on Reddit goes by that name."
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:
9
+ if "Sorry, nobody on Reddit goes by that name." in response.text:
22
10
  return 1
23
11
  else:
24
12
  return 0
25
13
  else:
26
- return 2
14
+ return 2
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_reddit(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_reddit(user)
22
+
23
+ if result == 1:
24
+ print("Available!")
25
+ elif result == 0:
26
+ print("Unavailable!")
27
+ else:
28
+ print("Error occured!")
@@ -1,48 +1,35 @@
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_snapchat(user):
5
5
  url = f"https://www.snapchat.com/@{user}"
6
6
 
7
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,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
10
- 'Accept-Encoding': "gzip, deflate, br, zstd",
11
- 'sec-ch-ua': "\"Google Chrome\";v=\"141\", \"Not?A_Brand\";v=\"8\", \"Chromium\";v=\"141\"",
12
- 'sec-ch-ua-mobile': "?1",
13
- 'sec-ch-ua-platform': "\"Android\"",
14
- 'upgrade-insecure-requests': "1",
15
- 'sec-fetch-site': "none",
16
- 'sec-fetch-mode': "navigate",
17
- 'sec-fetch-user': "?1",
18
- 'sec-fetch-dest': "document",
19
- 'accept-language': "en-US,en;q=0.9",
20
- 'priority': "u=0, i"
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,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
10
+ 'Accept-Encoding': "gzip, deflate, br, zstd",
11
+ 'sec-ch-ua': "\"Google Chrome\";v=\"141\", \"Not?A_Brand\";v=\"8\", \"Chromium\";v=\"141\"",
12
+ 'sec-ch-ua-mobile': "?1",
13
+ 'sec-ch-ua-platform': "\"Android\"",
14
+ 'upgrade-insecure-requests': "1",
15
+ 'sec-fetch-site': "none",
16
+ 'sec-fetch-mode': "navigate",
17
+ 'sec-fetch-user': "?1",
18
+ 'sec-fetch-dest': "document",
19
+ 'accept-language': "en-US,en;q=0.9",
20
+ 'priority': "u=0, i"
21
21
  }
22
22
 
23
- try:
24
- response = httpx.get(url, headers=headers, follow_redirects=True, timeout = 3.0)
25
- status = response.status_code
26
-
27
- if status == 200:
28
- return 0
29
- elif status == 404:
30
- return 1
31
- else:
32
- return 2
23
+ return status_validate(url, 404, 200, headers=headers, follow_redirects=True)
33
24
 
34
- except (ConnectError, TimeoutException):
35
- return 2
36
- except Exception:
37
- return 2
38
25
 
39
26
  if __name__ == "__main__":
40
- user = input ("Username?: ").strip()
41
- result = validate_snapchat(user)
27
+ user = input("Username?: ").strip()
28
+ result = validate_snapchat(user)
42
29
 
43
- if result == 1:
44
- print("Available!")
45
- elif result == 0:
46
- print("Unavailable!")
47
- else:
48
- print("Error occured!")
30
+ if result == 1:
31
+ print("Available!")
32
+ elif result == 0:
33
+ print("Unavailable!")
34
+ else:
35
+ print("Error occured!")
@@ -1,5 +1,6 @@
1
- import httpx
2
1
  import re
2
+ from user_scanner.core.orchestrator import generic_validate
3
+
3
4
 
4
5
  def validate_telegram(user: str) -> int:
5
6
  """
@@ -7,28 +8,22 @@ def validate_telegram(user: str) -> int:
7
8
  Returns: 1 -> available, 0 -> taken, 2 -> error
8
9
  """
9
10
  url = f"https://t.me/{user}"
10
- headers = {
11
- "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36"
12
- }
13
11
 
14
- try:
15
- r = httpx.get(url, headers=headers, follow_redirects=True, timeout=3.0)
12
+ def process(r):
16
13
  if r.status_code == 200:
17
14
  return 0 if re.search(r'<div[^>]*class="tgme_page_extra"[^>]*>', r.text) else 1
18
15
  return 2
19
- except (httpx.ConnectError, httpx.TimeoutException):
20
- return 2
21
- except Exception:
22
- return 2
16
+
17
+ return generic_validate(url, process, follow_redirects=True)
23
18
 
24
19
 
25
20
  if __name__ == "__main__":
26
- user = input ("Username?: ").strip()
27
- result = validate_telegram(user)
21
+ user = input("Username?: ").strip()
22
+ result = validate_telegram(user)
28
23
 
29
- if result == 1:
30
- print("Available!")
31
- elif result == 0:
32
- print("Unavailable!")
33
- else:
34
- print("Error occured!")
24
+ if result == 1:
25
+ print("Available!")
26
+ elif result == 0:
27
+ print("Unavailable!")
28
+ else:
29
+ print("Error occured!")