1
0
Fork 0
mirror of https://github.com/Jackett/Jackett synced 2025-02-25 07:32:38 +00:00

TorrentLeech: Fix login (#412) (#414)

* Fix login #412

* Update TorrentLeech.cs
This commit is contained in:
Superpiffer 2016-08-05 13:57:43 +02:00 committed by flightlevel
parent 2afce9f2d9
commit ccde6fb53b

View file

@ -82,6 +82,12 @@ namespace Jackett.Indexers
public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
{
configData.LoadValuesFromJson(configJson);
await DoLogin();
return IndexerConfigurationStatus.RequiresTesting;
}
private async Task DoLogin()
{
var pairs = new Dictionary<string, string> {
{ "username", configData.Username.Value },
{ "password", configData.Password.Value },
@ -97,11 +103,17 @@ namespace Jackett.Indexers
var errorMessage = messageEl.Text().Trim();
throw new ExceptionWithConfigData(errorMessage, configData);
});
return IndexerConfigurationStatus.RequiresTesting;
}
public async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
{
var loggedInCheck = await RequestStringWithCookies(SearchUrl);
if (!loggedInCheck.Content.Contains("/logout.php"))
{
//Cookie appears to expire after a period of time or logging in to the site via browser
await DoLogin();
}
var releases = new List<ReleaseInfo>();
var searchString = query.GetQueryString();
var searchUrl = SearchUrl;