TorrentBytes: Login again if the cookies became invalid (#651)

This commit is contained in:
kaso17 2016-11-06 17:41:22 +01:00 committed by GitHub
parent 2198aebf73
commit c8831b157e
1 changed files with 9 additions and 1 deletions

View File

@ -73,7 +73,8 @@ namespace Jackett.Indexers
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
{
configData.LoadValuesFromJson(configJson);
if(configJson != null)
configData.LoadValuesFromJson(configJson);
var pairs = new Dictionary<string, string> {
{ "username", configData.Username.Value },
{ "password", configData.Password.Value },
@ -130,6 +131,13 @@ namespace Jackett.Indexers
private async Task ProcessPage(List<ReleaseInfo> releases, string searchUrl)
{
var response = await RequestStringWithCookiesAndRetry(searchUrl, null, BrowseUrl);
// On IP change the cookies become invalid, login again and retry
if (response.IsRedirect)
{
await ApplyConfiguration(null);
response = await RequestStringWithCookiesAndRetry(searchUrl, null, BrowseUrl);
}
var results = response.Content;
try
{