diff --git a/src/Jackett/Indexers/FunFile.cs b/src/Jackett/Indexers/FunFile.cs index 5a604efc8..1536df469 100644 --- a/src/Jackett/Indexers/FunFile.cs +++ b/src/Jackett/Indexers/FunFile.cs @@ -49,7 +49,9 @@ namespace Jackett.Indexers public async Task ApplyConfiguration(JToken configJson) { - configData.LoadValuesFromJson(configJson); + if (configJson != null) + configData.LoadValuesFromJson(configJson); + var pairs = new Dictionary { { "username", configData.Username.Value }, { "password", configData.Password.Value }, @@ -92,6 +94,14 @@ namespace Jackett.Indexers searchUrl += "?" + queryCollection.GetQueryString(); var results = await RequestStringWithCookiesAndRetry(searchUrl); + + // Occasionally the cookies become invalid, login again if that happens + if (results.IsRedirect) + { + await ApplyConfiguration(null); + results = await RequestStringWithCookiesAndRetry(searchUrl); + } + try { CQ dom = results.Content; diff --git a/src/Jackett/Indexers/ImmortalSeed.cs b/src/Jackett/Indexers/ImmortalSeed.cs index 245a9e80e..9775a218a 100644 --- a/src/Jackett/Indexers/ImmortalSeed.cs +++ b/src/Jackett/Indexers/ImmortalSeed.cs @@ -69,7 +69,9 @@ namespace Jackett.Indexers public async Task ApplyConfiguration(JToken configJson) { - configData.LoadValuesFromJson(configJson); + if (configJson != null) + configData.LoadValuesFromJson(configJson); + var pairs = new Dictionary { { "username", configData.Username.Value }, { "password", configData.Password.Value } @@ -99,6 +101,13 @@ namespace Jackett.Indexers var results = await RequestStringWithCookiesAndRetry(searchUrl); + // Occasionally the cookies become invalid, login again if that happens + if (results.Content.Contains("You do not have permission to access this page.")) + { + await ApplyConfiguration(null); + results = await RequestStringWithCookiesAndRetry(searchUrl); + } + try { CQ dom = results.Content;