From 45a201db841ae9a4fadfd64214f2397031ec0534 Mon Sep 17 00:00:00 2001 From: Luka <164436043+ghluka@users.noreply.github.com> Date: Mon, 6 May 2024 14:44:01 -0400 Subject: [PATCH] Linktree checker --- README.md | 3 ++- src/checkers/linktree.py | 27 +++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 src/checkers/linktree.py diff --git a/README.md b/README.md index 8ee6a61..864944f 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ $ pip install -r requirements.txt $ python3 main.py ``` -## 📃 Supported websites [15 total] +## 📃 Supported websites [16 total] - [Chess.com](https://chess.com/) - [Github](https://github.com/) @@ -26,6 +26,7 @@ $ python3 main.py - [Instagram](https://instagram.com/) - [Kahoot](https://kahoot.it/) - [Lichess](https://lichess.org/) +- [Linktree](https://linktr.ee/) - [Minecraft](https://minecraft.net/) - [Replit](https://repl.it/) - [Roblox](https://roblox.com/) 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