mirror of
https://github.com/Jackett/Jackett
synced 2025-02-26 16:12:55 +00:00
dc added a captcha system.. cookie workaround!
This commit is contained in:
parent
e098943b69
commit
8b34e80d5b
1 changed files with 27 additions and 15 deletions
|
@ -2,6 +2,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Jackett.Common.Models;
|
||||
|
@ -20,12 +21,13 @@ namespace Jackett.Common.Indexers
|
|||
private string SearchUrl { get { return SiteLink + "api/v1/torrents"; } }
|
||||
private string LoginUrl { get { return SiteLink + "api/v1/auth"; } }
|
||||
|
||||
private new ConfigurationDataBasicLogin configData
|
||||
private new ConfigurationDataCookie configData
|
||||
{
|
||||
get { return (ConfigurationDataBasicLogin)base.configData; }
|
||||
get { return (ConfigurationDataCookie)base.configData; }
|
||||
set { base.configData = value; }
|
||||
}
|
||||
|
||||
|
||||
public Digitalcore(IIndexerConfigurationService configService, WebClient w, Logger l, IProtectionService ps)
|
||||
: base(name: "DigitalCore",
|
||||
description: "DigitalCore is a Private Torrent Tracker for MOVIES / TV / GENERAL",
|
||||
|
@ -35,7 +37,7 @@ namespace Jackett.Common.Indexers
|
|||
client: w,
|
||||
logger: l,
|
||||
p: ps,
|
||||
configData: new ConfigurationDataBasicLogin())
|
||||
configData: new ConfigurationDataCookie())
|
||||
{
|
||||
Encoding = Encoding.UTF8;
|
||||
Language = "en-us";
|
||||
|
@ -83,19 +85,26 @@ namespace Jackett.Common.Indexers
|
|||
public override async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson)
|
||||
{
|
||||
LoadValuesFromJson(configJson);
|
||||
var queryCollection = new NameValueCollection();
|
||||
|
||||
queryCollection.Add("username", configData.Username.Value);
|
||||
queryCollection.Add("password", configData.Password.Value);
|
||||
|
||||
var loginUrl = LoginUrl + "?" + queryCollection.GetQueryString();
|
||||
var loginResult = await RequestStringWithCookies(loginUrl, null, SiteLink);
|
||||
|
||||
await ConfigureIfOK(loginResult.Cookies, loginResult.Content.Contains("\"user\""), () =>
|
||||
// TODO: implement captcha
|
||||
CookieHeader = configData.Cookie.Value;
|
||||
try
|
||||
{
|
||||
throw new ExceptionWithConfigData(loginResult.Content, configData);
|
||||
});
|
||||
return IndexerConfigurationStatus.RequiresTesting;
|
||||
var results = await PerformQuery(new TorznabQuery());
|
||||
if (results.Count() == 0)
|
||||
{
|
||||
throw new Exception("Your cookie did not work");
|
||||
}
|
||||
|
||||
IsConfigured = true;
|
||||
SaveConfig();
|
||||
return IndexerConfigurationStatus.Completed;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
IsConfigured = false;
|
||||
throw new Exception("Your cookie did not work: " + e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
protected override async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
|
||||
|
@ -162,6 +171,7 @@ namespace Jackett.Common.Indexers
|
|||
release.BannerUrl = (row.firstpic);
|
||||
}
|
||||
|
||||
|
||||
if (row.imdbid2 != null && row.imdbid2.ToString().StartsWith("tt"))
|
||||
{
|
||||
release.Imdb = ParseUtil.CoerceLong(row.imdbid2.ToString().Substring(2));
|
||||
|
@ -171,6 +181,8 @@ namespace Jackett.Common.Indexers
|
|||
descriptions.Add("Tagline: " + row.tagline);
|
||||
descriptions.Add("Cast: " + row.cast);
|
||||
descriptions.Add("Rating: " + row.rating);
|
||||
//descriptions.Add("Plot: " + row.plot);
|
||||
|
||||
release.BannerUrl = new Uri(SiteLink + "img/imdb/" + row.imdbid2 + ".jpg");
|
||||
}
|
||||
|
||||
|
@ -193,7 +205,7 @@ namespace Jackett.Common.Indexers
|
|||
|
||||
release.Description = string.Join("<br>\n", descriptions);
|
||||
|
||||
releases.Add(release);
|
||||
releases.Add(release);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue