Skip to content

Commit

Permalink
Forward user IP to torbox for CDN selection (#384)
Browse files Browse the repository at this point in the history
  • Loading branch information
ragmehos authored Dec 1, 2024
1 parent 348ccb7 commit 3e3b120
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions streaming_providers/torbox/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@ async def get_available_torrent(self, info_hash) -> dict[str, Any] | None:
return torrent
return {}

async def create_download_link(self, torrent_id, filename):
async def create_download_link(self, torrent_id, filename, user_ip):
response = await self._make_request(
"GET",
"/torrents/requestdl",
params={"token": self.token, "torrent_id": torrent_id, "file_id": filename},
params={"token": self.token, "torrent_id": torrent_id, "file_id": filename, "user_ip": user_ip},
is_expected_to_fail=True,
)
if "successfully" in response.get("detail"):
Expand Down
3 changes: 3 additions & 0 deletions streaming_providers/torbox/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ async def get_video_url_from_torbox(
magnet_link: str,
user_data: UserData,
filename: str,
user_ip: str,
episode: Optional[int] = None,
**kwargs: Any,
) -> str:
Expand All @@ -31,6 +32,7 @@ async def get_video_url_from_torbox(
response = await torbox_client.create_download_link(
torrent_info.get("id", ""),
file_id,
user_ip,
)
return response["data"]
else:
Expand All @@ -47,6 +49,7 @@ async def get_video_url_from_torbox(
response = await torbox_client.create_download_link(
torrent_info.get("id", ""),
file_id,
user_ip,
)
return response["data"]

Expand Down

0 comments on commit 3e3b120

Please sign in to comment.