Skip to content

Commit

Permalink
Linktree checker
Browse files Browse the repository at this point in the history
  • Loading branch information
ghluka committed May 6, 2024
1 parent 807aca3 commit 3232ea9
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/checkers/linktree.py
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 3232ea9

Please sign in to comment.