From da70175e483a49d63528cab4f7f1a99ea112494d Mon Sep 17 00:00:00 2001 From: txrms <78548431+txrmsconditions@users.noreply.github.com> Date: Thu, 3 Apr 2025 22:38:58 +0200 Subject: [PATCH 1/2] Update linktree.py no idea what i'm doing --- linktree.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/linktree.py b/linktree.py index 8f1b887..5d900f0 100644 --- a/linktree.py +++ b/linktree.py @@ -70,7 +70,13 @@ async def uncensorLinks(self, account_id : int, link_ids : Union[List[int], int] json_resp = await resp.json() await session.close() - _links = json_resp["links"] + json_resp = await resp.json() + if not json_resp or "links" not in json_resp: + await session.close() + return [] # Return an empty list instead of breaking + + links = json_resp["links"] + links = [] for _link in _links: @@ -120,7 +126,7 @@ async def getLinktreeUserInfo(self, url : Optional[str] = None, username : Optio avatar_image = account["profilePictureUrl"] url = f"https://linktr.ee/{username}" if url is None else url id = account["id"] - tier = account["tier"] + tier = account.get("tier", "Unknown") # You can replace "Unknown" with any default value isActive = account["isActive"] createdAt = account["createdAt"] updatedAt = account["updatedAt"] @@ -170,6 +176,5 @@ async def main(): if __name__ == "__main__": - loop = asyncio.get_event_loop() - loop.run_until_complete(main()) + asyncio.run(main()) From c20231f4ab7ed06c7860bd2c3aa93d8b24ebb22d Mon Sep 17 00:00:00 2001 From: txrms <78548431+txrmsconditions@users.noreply.github.com> Date: Thu, 3 Apr 2025 22:41:19 +0200 Subject: [PATCH 2/2] Update linktree.py removed chatgpt's useless comments --- linktree.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/linktree.py b/linktree.py index 5d900f0..62443da 100644 --- a/linktree.py +++ b/linktree.py @@ -73,7 +73,7 @@ async def uncensorLinks(self, account_id : int, link_ids : Union[List[int], int] json_resp = await resp.json() if not json_resp or "links" not in json_resp: await session.close() - return [] # Return an empty list instead of breaking + return [] links = json_resp["links"] @@ -126,8 +126,7 @@ async def getLinktreeUserInfo(self, url : Optional[str] = None, username : Optio avatar_image = account["profilePictureUrl"] url = f"https://linktr.ee/{username}" if url is None else url id = account["id"] - tier = account.get("tier", "Unknown") # You can replace "Unknown" with any default value - isActive = account["isActive"] + tier = account.get("tier", "Unknown") createdAt = account["createdAt"] updatedAt = account["updatedAt"] description = account["description"]