From 683ebca0064e8bd5973a490d14fb0edba436d9c0 Mon Sep 17 00:00:00 2001 From: kaso17 Date: Tue, 30 Oct 2018 12:26:27 +0100 Subject: [PATCH] Rarbg: add torrent file download option --- src/Jackett.Common/Indexers/Rarbg.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Jackett.Common/Indexers/Rarbg.cs b/src/Jackett.Common/Indexers/Rarbg.cs index d7de31b77..23595f6a5 100644 --- a/src/Jackett.Common/Indexers/Rarbg.cs +++ b/src/Jackett.Common/Indexers/Rarbg.cs @@ -217,6 +217,7 @@ namespace Jackett.Common.Indexers release.InfoHash = release.MagnetUri.ToString().Split(':')[3].Split('&')[0]; release.Comments = new Uri(item.Value("info_page")); + release.Link = release.Comments; // in case of a torrent download we grab the link from the details page in Download() release.Guid = release.MagnetUri; var episode_info = item.Value("episode_info"); @@ -251,5 +252,18 @@ namespace Jackett.Common.Indexers return releases; } + + public override async Task Download(Uri link) + { + // build download link from info redirect link + var response = await RequestStringWithCookies(link.ToString()); + if (!response.IsRedirect) + throw new Exception("Downlaod Failed, expected redirect"); + + var targeturi = new Uri(response.RedirectingTo); + var id = targeturi.Segments.Last(); + var dluri = new Uri(targeturi, "/download.php?id=" + id + "&f=jackett.torrent"); + return await base.Download(dluri, RequestType.GET); + } } }