scenetime: check expired cookie. resolves #8359 (#8374)

This commit is contained in:
Diego Heras
2020-04-26 21:24:05 +02:00
committed by GitHub
parent 1a82f2400d
commit 51263fb2d1

View File

@@ -24,23 +24,18 @@ namespace Jackett.Common.Indexers
private string SearchUrl => SiteLink + "browse.php"; private string SearchUrl => SiteLink + "browse.php";
private string DownloadUrl => SiteLink + "download.php/{0}/download.torrent"; private string DownloadUrl => SiteLink + "download.php/{0}/download.torrent";
private new ConfigurationDataSceneTime configData => (ConfigurationDataSceneTime)base.configData;
private new ConfigurationDataSceneTime configData
{
get => (ConfigurationDataSceneTime)base.configData;
set => base.configData = value;
}
public SceneTime(IIndexerConfigurationService configService, WebClient w, Logger l, IProtectionService ps) public SceneTime(IIndexerConfigurationService configService, WebClient w, Logger l, IProtectionService ps)
: base(name: "SceneTime", : base("SceneTime",
description: "Always on time", description: "Always on time",
link: "https://www.scenetime.com/", link: "https://www.scenetime.com/",
caps: new TorznabCapabilities(), caps: new TorznabCapabilities(),
configService: configService, configService: configService,
client: w, client: w,
logger: l, logger: l,
p: ps, p: ps,
configData: new ConfigurationDataSceneTime()) configData: new ConfigurationDataSceneTime())
{ {
Encoding = Encoding.GetEncoding("iso-8859-1"); Encoding = Encoding.GetEncoding("iso-8859-1");
Language = "en-us"; Language = "en-us";
@@ -118,17 +113,15 @@ namespace Jackett.Common.Indexers
result.Captcha.SiteKey = recaptcha.GetAttribute("data-sitekey"); result.Captcha.SiteKey = recaptcha.GetAttribute("data-sitekey");
return result; return result;
} }
else
var stdResult = new ConfigurationDataBasicLogin
{ {
var stdResult = new ConfigurationDataBasicLogin SiteLink = { Value = configData.SiteLink.Value },
{ Username = { Value = configData.Username.Value },
SiteLink = { Value = configData.SiteLink.Value }, Password = { Value = configData.Password.Value },
Username = { Value = configData.Username.Value }, CookieHeader = { Value = loginPage.Cookies }
Password = { Value = configData.Password.Value }, };
CookieHeader = { Value = loginPage.Cookies } return stdResult;
};
return stdResult;
}
} }
public override async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson) public override async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
@@ -147,7 +140,7 @@ namespace Jackett.Common.Indexers
{ {
var results = await PerformQuery(new TorznabQuery()); var results = await PerformQuery(new TorznabQuery());
if (!results.Any()) if (!results.Any())
throw new Exception("Your cookie did not work"); throw new Exception("Found 0 results in the tracker");
IsConfigured = true; IsConfigured = true;
SaveConfig(); SaveConfig();
@@ -194,6 +187,10 @@ namespace Jackett.Common.Indexers
var searchUrl = SearchUrl + "?" + qParams.GetQueryString(); var searchUrl = SearchUrl + "?" + qParams.GetQueryString();
var results = await RequestStringWithCookies(searchUrl); var results = await RequestStringWithCookies(searchUrl);
if (results.Content == null || !results.Content.Contains("/logout.php"))
throw new Exception("The user is not logged in. It is possible that the cookie has expired or you " +
"made a mistake when copying it. Please check the settings.");
var releases = ParseResponse(query, results.Content); var releases = ParseResponse(query, results.Content);
return releases; return releases;