diff --git a/src/NzbDrone.Core.Test/IndexerTests/RedactedTests/RedactedFixture.cs b/src/NzbDrone.Core.Test/IndexerTests/RedactedTests/RedactedFixture.cs index 447033938..a23162b5d 100644 --- a/src/NzbDrone.Core.Test/IndexerTests/RedactedTests/RedactedFixture.cs +++ b/src/NzbDrone.Core.Test/IndexerTests/RedactedTests/RedactedFixture.cs @@ -46,7 +46,7 @@ namespace NzbDrone.Core.Test.IndexerTests.RedactedTests torrentInfo.Title.Should().Be("Red Hot Chili Peppers - Californication [1999] [Album] [US / Reissue 2020] [FLAC 24bit Lossless] [Vinyl]"); torrentInfo.DownloadProtocol.Should().Be(DownloadProtocol.Torrent); - torrentInfo.DownloadUrl.Should().Be("https://redacted.ch/ajax.php?action=download&id=3892313&usetoken=0"); + torrentInfo.DownloadUrl.Should().Be("https://redacted.ch/ajax.php?action=download&id=3892313"); torrentInfo.InfoUrl.Should().Be("https://redacted.ch/torrents.php?id=16720&torrentid=3892313"); torrentInfo.CommentUrl.Should().BeNullOrEmpty(); torrentInfo.Indexer.Should().Be(Subject.Definition.Name); diff --git a/src/NzbDrone.Core.Test/IndexerTests/SecretCinemaTests/SecretCinemaFixture.cs b/src/NzbDrone.Core.Test/IndexerTests/SecretCinemaTests/SecretCinemaFixture.cs index b62c5c7d1..e3aa89400 100644 --- a/src/NzbDrone.Core.Test/IndexerTests/SecretCinemaTests/SecretCinemaFixture.cs +++ b/src/NzbDrone.Core.Test/IndexerTests/SecretCinemaTests/SecretCinemaFixture.cs @@ -21,7 +21,7 @@ namespace NzbDrone.Core.Test.IndexerTests.SecretCinemaTests [SetUp] public void Setup() { - Subject.Definition = new IndexerDefinition() + Subject.Definition = new IndexerDefinition { Name = "SecretCinema", Settings = new GazelleSettings { Username = "somekey", Password = "somekey" } @@ -46,7 +46,7 @@ namespace NzbDrone.Core.Test.IndexerTests.SecretCinemaTests torrentInfo.Title.Should().Be("Singin' in the Rain (1952) 2160p"); torrentInfo.DownloadProtocol.Should().Be(DownloadProtocol.Torrent); - torrentInfo.DownloadUrl.Should().Be("https://secret-cinema.pw/torrents.php?action=download&useToken=0&id=45068"); + torrentInfo.DownloadUrl.Should().Be("https://secret-cinema.pw/torrents.php?action=download&id=45068"); torrentInfo.InfoUrl.Should().Be("https://secret-cinema.pw/torrents.php?id=2497&torrentid=45068"); torrentInfo.CommentUrl.Should().BeNullOrEmpty(); torrentInfo.Indexer.Should().Be(Subject.Definition.Name); diff --git a/src/NzbDrone.Core/Indexers/Definitions/Gazelle/GazelleBase.cs b/src/NzbDrone.Core/Indexers/Definitions/Gazelle/GazelleBase.cs index 67dee072f..82b6d5e5c 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Gazelle/GazelleBase.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Gazelle/GazelleBase.cs @@ -97,8 +97,8 @@ public abstract class GazelleBase : TorrentIndexerBase || html.Contains("This torrent is too large.") || html.Contains("You cannot use tokens here")) { - // download again with usetoken=0 - var requestLinkNew = link.ToString().Replace("usetoken=1", "usetoken=0"); + // download again without usetoken=1 + var requestLinkNew = link.ToString().Replace("&usetoken=1", ""); response = await base.Download(new Uri(requestLinkNew)); } diff --git a/src/NzbDrone.Core/Indexers/Definitions/Gazelle/GazelleParser.cs b/src/NzbDrone.Core/Indexers/Definitions/Gazelle/GazelleParser.cs index 77e25530b..b58e02f37 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Gazelle/GazelleParser.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Gazelle/GazelleParser.cs @@ -151,9 +151,13 @@ public class GazelleParser : IParseIndexerResponse var url = new HttpUri(Settings.BaseUrl) .CombinePath("/torrents.php") .AddQueryParam("action", "download") - .AddQueryParam("usetoken", Settings.UseFreeleechToken ? "1" : "0") .AddQueryParam("id", torrentId); + if (Settings.UseFreeleechToken) + { + url = url.AddQueryParam("usetoken", "1"); + } + return url.FullUri; } diff --git a/src/NzbDrone.Core/Indexers/Definitions/GreatPosterWall.cs b/src/NzbDrone.Core/Indexers/Definitions/GreatPosterWall.cs index 5112ee634..4fd2fc964 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/GreatPosterWall.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/GreatPosterWall.cs @@ -215,9 +215,13 @@ public class GreatPosterWallParser : GazelleParser var url = new HttpUri(_settings.BaseUrl) .CombinePath("/torrents.php") .AddQueryParam("action", "download") - .AddQueryParam("usetoken", _settings.UseFreeleechToken && canUseToken ? "1" : "0") .AddQueryParam("id", torrentId); + if (_settings.UseFreeleechToken && canUseToken) + { + url = url.AddQueryParam("usetoken", "1"); + } + return url.FullUri; } diff --git a/src/NzbDrone.Core/Indexers/Definitions/Orpheus.cs b/src/NzbDrone.Core/Indexers/Definitions/Orpheus.cs index 9a1c8e3bc..44999d0f5 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Orpheus.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Orpheus.cs @@ -370,8 +370,6 @@ namespace NzbDrone.Core.Indexers.Definitions private string GetDownloadUrl(int torrentId, bool canUseToken) { - // AuthKey is required but not checked, just pass in a dummy variable - // to avoid having to track authkey, which is randomly cycled var url = new HttpUri(_settings.BaseUrl) .CombinePath("/ajax.php") .AddQueryParam("action", "download") diff --git a/src/NzbDrone.Core/Indexers/Definitions/Redacted.cs b/src/NzbDrone.Core/Indexers/Definitions/Redacted.cs index 75be60a39..0055f8c61 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/Redacted.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/Redacted.cs @@ -336,13 +336,15 @@ namespace NzbDrone.Core.Indexers.Definitions private string GetDownloadUrl(int torrentId, bool canUseToken) { - // AuthKey is required but not checked, just pass in a dummy variable - // to avoid having to track authkey, which is randomly cycled var url = new HttpUri(_settings.BaseUrl) .CombinePath("/ajax.php") .AddQueryParam("action", "download") - .AddQueryParam("id", torrentId) - .AddQueryParam("usetoken", (_settings.UseFreeleechToken && canUseToken) ? 1 : 0); + .AddQueryParam("id", torrentId); + + if (_settings.UseFreeleechToken && canUseToken) + { + url = url.AddQueryParam("usetoken", "1"); + } return url.FullUri; } diff --git a/src/NzbDrone.Core/Indexers/Definitions/SecretCinema.cs b/src/NzbDrone.Core/Indexers/Definitions/SecretCinema.cs index fb887a01d..568d083e9 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/SecretCinema.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/SecretCinema.cs @@ -213,14 +213,18 @@ public class SecretCinemaParser : IParseIndexerResponse return category.Contains(NewznabStandardCategory.Movies) || NewznabStandardCategory.Movies.SubCategories.Any(subCat => category.Contains(subCat)); } - protected virtual string GetDownloadUrl(int torrentId) + private string GetDownloadUrl(int torrentId) { var url = new HttpUri(_settings.BaseUrl) .CombinePath("/torrents.php") .AddQueryParam("action", "download") - .AddQueryParam("useToken", _settings.UseFreeleechToken ? "1" : "0") .AddQueryParam("id", torrentId); + if (_settings.UseFreeleechToken) + { + url = url.AddQueryParam("useToken", "1"); + } + return url.FullUri; }