TorrentDay: update to latest URLs/redirect scheme

This commit is contained in:
kaso17 2016-12-11 05:50:08 +01:00
parent 4f86272074
commit e0e81ff52b
1 changed files with 14 additions and 2 deletions

View File

@ -48,7 +48,7 @@ namespace Jackett.Indexers
public TorrentDay(IIndexerManagerService i, Logger l, IWebClient wc, IProtectionService ps)
: base(name: "TorrentDay",
description: "TorrentDay",
link: "https://torrentday.it/",
link: "https://www.torrentday.com/",
caps: TorznabUtil.CreateDefaultTorznabTVCaps(),
manager: i,
client: wc,
@ -111,6 +111,10 @@ namespace Jackett.Indexers
public override async Task<ConfigurationData> GetConfigurationForSetup()
{
var loginPage = await RequestStringWithCookies(StartPageUrl, string.Empty);
if (loginPage.IsRedirect)
loginPage = await RequestStringWithCookies(loginPage.RedirectingTo, string.Empty);
if (loginPage.IsRedirect)
loginPage = await RequestStringWithCookies(loginPage.RedirectingTo, string.Empty);
CQ cq = loginPage.Content;
var result = this.configData;
result.CookieHeader.Value = loginPage.Cookies;
@ -164,6 +168,11 @@ namespace Jackett.Indexers
errorMessage = dom.Text();
}
if (string.IsNullOrWhiteSpace(errorMessage) && result.IsRedirect)
{
errorMessage = string.Format("Got a redirect to {0}, please adjust your the alternative link", result.RedirectingTo);
}
throw new ExceptionWithConfigData(errorMessage, configData);
});
return IndexerConfigurationStatus.RequiresTesting;
@ -196,7 +205,10 @@ namespace Jackett.Indexers
// Check for being logged out
if (results.IsRedirect)
throw new ExceptionWithConfigData("Login failed, please reconfigure the tracker to update the cookies", configData);
if (results.RedirectingTo.Contains("login.php"))
throw new ExceptionWithConfigData("Login failed, please reconfigure the tracker to update the cookies", configData);
else
throw new ExceptionWithConfigData(string.Format("Got a redirect to {0}, please adjust your the alternative link", results.RedirectingTo), configData);
try
{