From dfaf12b6afcf7d1aa2d7d998bdf9dedef8ec0502 Mon Sep 17 00:00:00 2001 From: Goldy <153996346+g0ldyy@users.noreply.github.com> Date: Fri, 12 Jul 2024 00:22:18 +0200 Subject: [PATCH] fix: torbox faster (removed useless checks) --- comet/debrid/torbox.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/comet/debrid/torbox.py b/comet/debrid/torbox.py index c59ebd8..4f8f1e1 100644 --- a/comet/debrid/torbox.py +++ b/comet/debrid/torbox.py @@ -125,17 +125,18 @@ async def generate_download_link(self, hash: str, index: str): create_torrent = await create_torrent.json() torrent_id = create_torrent["data"]["torrent_id"] - get_torrents = await self.session.get( - f"{self.api_url}/torrents/mylist?bypass_cache=true" - ) - get_torrents = await get_torrents.json() + # get_torrents = await self.session.get( + # f"{self.api_url}/torrents/mylist?bypass_cache=true" + # ) + # get_torrents = await get_torrents.json() - for torrent in get_torrents["data"]: - if torrent["id"] == torrent_id: - file_id = torrent["files"][int(index)]["id"] + # for torrent in get_torrents["data"]: + # if torrent["id"] == torrent_id: + # file_id = torrent["files"][int(index)]["id"] + # Useless, we already have file index get_download_link = await self.session.get( - f"{self.api_url}/torrents/requestdl?token={self.debrid_api_key}&torrent_id={torrent_id}&file_id={file_id}&zip=false", + f"{self.api_url}/torrents/requestdl?token={self.debrid_api_key}&torrent_id={torrent_id}&file_id={index}&zip=false", ) get_download_link = await get_download_link.json()