mirror of https://github.com/Jackett/Jackett
TorrentBytes: Login again if the cookies became invalid (#651)
This commit is contained in:
parent
2198aebf73
commit
c8831b157e
|
@ -73,7 +73,8 @@ namespace Jackett.Indexers
|
||||||
|
|
||||||
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
configData.LoadValuesFromJson(configJson);
|
if(configJson != null)
|
||||||
|
configData.LoadValuesFromJson(configJson);
|
||||||
var pairs = new Dictionary<string, string> {
|
var pairs = new Dictionary<string, string> {
|
||||||
{ "username", configData.Username.Value },
|
{ "username", configData.Username.Value },
|
||||||
{ "password", configData.Password.Value },
|
{ "password", configData.Password.Value },
|
||||||
|
@ -130,6 +131,13 @@ namespace Jackett.Indexers
|
||||||
private async Task ProcessPage(List<ReleaseInfo> releases, string searchUrl)
|
private async Task ProcessPage(List<ReleaseInfo> releases, string searchUrl)
|
||||||
{
|
{
|
||||||
var response = await RequestStringWithCookiesAndRetry(searchUrl, null, BrowseUrl);
|
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;
|
var results = response.Content;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue