From 209b4fd337572ae5002d5a39ba72af392e9f47d7 Mon Sep 17 00:00:00 2001 From: Heavy Harlow <89617161+Plungis@users.noreply.github.com> Date: Tue, 28 Jul 2026 16:42:06 -0400 Subject: [PATCH] Include torrent ID in MaM download requests --- mlm_mam/src/api.rs | 3 ++- server/src/torrent_downloader.rs | 10 +++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/mlm_mam/src/api.rs b/mlm_mam/src/api.rs index eb7ad66d..716fd18b 100644 --- a/mlm_mam/src/api.rs +++ b/mlm_mam/src/api.rs @@ -191,12 +191,13 @@ impl<'a> MaM<'a> { } } - pub async fn get_torrent_file(&self, dl_hash: &str) -> Result { + pub async fn get_torrent_file(&self, dl_hash: &str, mam_id: u64) -> Result { let resp = self .client .get(format!( "https://www.myanonamouse.net/tor/download.php/{dl_hash}" )) + .query(&[("tid", mam_id)]) .send() .await? .error_for_status() diff --git a/server/src/torrent_downloader.rs b/server/src/torrent_downloader.rs index b404ed12..6e1c276f 100644 --- a/server/src/torrent_downloader.rs +++ b/server/src/torrent_downloader.rs @@ -113,7 +113,7 @@ async fn grab_torrent( ); let user_info = mam.user_info().await?; - let torrent_file_bytes = get_mam_torrent_file(mam, &torrent.dl_link).await?; + let torrent_file_bytes = get_mam_torrent_file(mam, &torrent.dl_link, torrent.mam_id).await?; let torrent_file = Torrent::read_from_bytes(torrent_file_bytes.clone())?; let hash = torrent_file.info_hash(); @@ -336,9 +336,13 @@ async fn get_existing_qbit_torrent( None } -pub(crate) async fn get_mam_torrent_file(mam: &MaM<'_>, dl_link: &str) -> Result { +pub(crate) async fn get_mam_torrent_file( + mam: &MaM<'_>, + dl_link: &str, + mam_id: u64, +) -> Result { loop { - let result = mam.get_torrent_file(dl_link).await; + let result = mam.get_torrent_file(dl_link, mam_id).await; match result { Ok(v) => return Ok(v),