diff --git a/src/NzbDrone.Core.Test/IndexerTests/PTPTests/PTPFixture.cs b/src/NzbDrone.Core.Test/IndexerTests/PTPTests/PTPFixture.cs index 5f01a18862..a94be92cb9 100644 --- a/src/NzbDrone.Core.Test/IndexerTests/PTPTests/PTPFixture.cs +++ b/src/NzbDrone.Core.Test/IndexerTests/PTPTests/PTPFixture.cs @@ -49,7 +49,7 @@ public async Task should_parse_feed_from_PTP(string fileName) first.Guid.Should().Be("PassThePopcorn-452135"); first.Title.Should().Be("The.Night.Of.S01.BluRay.AAC2.0.x264-DEPTH"); first.DownloadProtocol.Should().Be(DownloadProtocol.Torrent); - first.DownloadUrl.Should().Be("https://passthepopcorn.me/torrents.php?action=download&id=452135&authkey=00000000000000000000000000000000&torrent_pass=00000000000000000000000000000000"); + first.DownloadUrl.Should().Be("https://passthepopcorn.me/torrents.php?action=download&id=452135"); first.InfoUrl.Should().Be("https://passthepopcorn.me/torrents.php?id=148131&torrentid=452135"); first.PublishDate.Should().Be(DateTime.Parse("2016-10-18T23:40:59+0000").ToUniversalTime()); diff --git a/src/NzbDrone.Core/Indexers/PassThePopcorn/PassThePopcorn.cs b/src/NzbDrone.Core/Indexers/PassThePopcorn/PassThePopcorn.cs index 3c42f2a283..d1b20b0ea4 100644 --- a/src/NzbDrone.Core/Indexers/PassThePopcorn/PassThePopcorn.cs +++ b/src/NzbDrone.Core/Indexers/PassThePopcorn/PassThePopcorn.cs @@ -33,5 +33,15 @@ public override IParseIndexerResponse GetParser() { return new PassThePopcornParser(Settings, _logger); } + + public override HttpRequest GetDownloadRequest(string link) + { + var request = new HttpRequest(link); + + request.Headers.Set("ApiUser", Settings.APIUser); + request.Headers.Set("ApiKey", Settings.APIKey); + + return request; + } } } diff --git a/src/NzbDrone.Core/Indexers/PassThePopcorn/PassThePopcornApi.cs b/src/NzbDrone.Core/Indexers/PassThePopcorn/PassThePopcornApi.cs index c9a591be12..6c38ea5d06 100644 --- a/src/NzbDrone.Core/Indexers/PassThePopcorn/PassThePopcornApi.cs +++ b/src/NzbDrone.Core/Indexers/PassThePopcorn/PassThePopcornApi.cs @@ -6,10 +6,8 @@ namespace NzbDrone.Core.Indexers.PassThePopcorn public class PassThePopcornResponse { public string TotalResults { get; set; } - public List Movies { get; set; } + public IReadOnlyCollection Movies { get; set; } public string Page { get; set; } - public string AuthKey { get; set; } - public string PassKey { get; set; } } public class PassThePopcornMovie @@ -18,9 +16,9 @@ public class PassThePopcornMovie public string Title { get; set; } public string Year { get; set; } public string Cover { get; set; } - public List Tags { get; set; } + public IReadOnlyCollection Tags { get; set; } public string ImdbId { get; set; } - public List Torrents { get; set; } + public IReadOnlyCollection Torrents { get; set; } } public class PassThePopcornTorrent diff --git a/src/NzbDrone.Core/Indexers/PassThePopcorn/PassThePopcornParser.cs b/src/NzbDrone.Core/Indexers/PassThePopcorn/PassThePopcornParser.cs index 35e4e059e2..0757423c4d 100644 --- a/src/NzbDrone.Core/Indexers/PassThePopcorn/PassThePopcornParser.cs +++ b/src/NzbDrone.Core/Indexers/PassThePopcorn/PassThePopcornParser.cs @@ -75,7 +75,6 @@ public IList ParseResponse(IndexerResponse indexerResponse) flags |= IndexerFlags.G_Scene; } - // Only add approved torrents try { torrentInfos.Add(new PassThePopcornInfo @@ -83,7 +82,7 @@ public IList ParseResponse(IndexerResponse indexerResponse) Guid = $"PassThePopcorn-{id}", Title = torrent.ReleaseName, Size = long.Parse(torrent.Size), - DownloadUrl = GetDownloadUrl(id, jsonResponse.AuthKey, jsonResponse.PassKey), + DownloadUrl = GetDownloadUrl(id), InfoUrl = GetInfoUrl(result.GroupId, id), Seeders = int.Parse(torrent.Seeders), Peers = int.Parse(torrent.Leechers) + int.Parse(torrent.Seeders), @@ -118,16 +117,12 @@ public IList ParseResponse(IndexerResponse indexerResponse) torrentInfos; } - public Action, DateTime?> CookiesUpdater { get; set; } - - private string GetDownloadUrl(int torrentId, string authKey, string passKey) + private string GetDownloadUrl(int torrentId) { var url = new HttpUri(_settings.BaseUrl) .CombinePath("/torrents.php") .AddQueryParam("action", "download") - .AddQueryParam("id", torrentId) - .AddQueryParam("authkey", authKey) - .AddQueryParam("torrent_pass", passKey); + .AddQueryParam("id", torrentId); return url.FullUri; } @@ -141,5 +136,7 @@ private string GetInfoUrl(string groupId, int torrentId) return url.FullUri; } + + public Action, DateTime?> CookiesUpdater { get; set; } } }