diff --git a/src/checkers/linktree.py b/src/checkers/linktree.py new file mode 100644 index 0000000..153df36 --- /dev/null +++ b/src/checkers/linktree.py @@ -0,0 +1,27 @@ +"""https://linktr.ee/ +""" +import time + +import httpx +from httpx._models import Response + +from base.checker import BaseChecker + + +class Checker(BaseChecker): + ENDPOINT = "https://linktr.ee/validate/username" + + @BaseChecker.check.register + def _(self, username:str) -> str|None: + headers = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36 Edg/124.0.0.0"} + payload = {"username": username, "returnSuggestions": True} + + r = Response(429) + while r.status_code == 429: + with httpx.Client(verify=False, proxies=self.proxies) as client: + r = client.post(self.ENDPOINT, json=payload, headers=headers) + if r.status_code == 429: + time.sleep(self.RATELIMIT_TIMEOUT) + + print(r.status_code) + return username if r.json()["result"] == "success" else None \ No newline at end of file