diff --git a/src/Jackett/Indexers/TorrentLeech.cs b/src/Jackett/Indexers/TorrentLeech.cs index 9836a62ab..3126e6538 100644 --- a/src/Jackett/Indexers/TorrentLeech.cs +++ b/src/Jackett/Indexers/TorrentLeech.cs @@ -82,6 +82,12 @@ namespace Jackett.Indexers public async Task ApplyConfiguration(JToken configJson) { configData.LoadValuesFromJson(configJson); + await DoLogin(); + return IndexerConfigurationStatus.RequiresTesting; + } + + private async Task DoLogin() + { var pairs = new Dictionary { { "username", configData.Username.Value }, { "password", configData.Password.Value }, @@ -97,11 +103,17 @@ namespace Jackett.Indexers var errorMessage = messageEl.Text().Trim(); throw new ExceptionWithConfigData(errorMessage, configData); }); - return IndexerConfigurationStatus.RequiresTesting; } public async Task> PerformQuery(TorznabQuery query) { + var loggedInCheck = await RequestStringWithCookies(SearchUrl); + if (!loggedInCheck.Content.Contains("/logout.php")) + { + //Cookie appears to expire after a period of time or logging in to the site via browser + await DoLogin(); + } + var releases = new List(); var searchString = query.GetQueryString(); var searchUrl = SearchUrl;