mirror of
https://github.com/Jackett/Jackett.git
synced 2025-09-17 17:34:09 +02:00
nCore
Still a problem with the login & search doesn't work anymore with the RequestStringWithCookiesAndRetry function.
This commit is contained in:
@@ -23,8 +23,7 @@ namespace Jackett.Indexers
|
|||||||
private string SearchUrl = "https://ncore.cc/torrents.php";
|
private string SearchUrl = "https://ncore.cc/torrents.php";
|
||||||
private static string LoginUrl = "https://ncore.cc/login.php";
|
private static string LoginUrl = "https://ncore.cc/login.php";
|
||||||
private readonly string LoggedInUrl = "https://ncore.cc/index.php";
|
private readonly string LoggedInUrl = "https://ncore.cc/index.php";
|
||||||
//private string cookieHeader = "";
|
//private JToken configData = null;
|
||||||
private JToken configData = null;
|
|
||||||
|
|
||||||
private readonly string enSearch = "torrents.php?oldal=1&tipus=kivalasztottak_kozott&kivalasztott_tipus=xvidser,dvdser,hdser&mire={0}&miben=name";
|
private readonly string enSearch = "torrents.php?oldal=1&tipus=kivalasztottak_kozott&kivalasztott_tipus=xvidser,dvdser,hdser&mire={0}&miben=name";
|
||||||
private readonly string hunSearch = "torrents.php?oldal=1&tipus=kivalasztottak_kozott&kivalasztott_tipus=xvidser_hun,dvdser_hun,hdser_hun,mire={0}&miben=name";
|
private readonly string hunSearch = "torrents.php?oldal=1&tipus=kivalasztottak_kozott&kivalasztott_tipus=xvidser_hun,dvdser_hun,hdser_hun,mire={0}&miben=name";
|
||||||
@@ -45,55 +44,47 @@ namespace Jackett.Indexers
|
|||||||
logger: l)
|
logger: l)
|
||||||
{
|
{
|
||||||
SearchUrl = SearchUrlEnHun;
|
SearchUrl = SearchUrlEnHun;
|
||||||
//webclient = wc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<ConfigurationData> GetConfigurationForSetup()
|
public Task<ConfigurationData> GetConfigurationForSetup()
|
||||||
{
|
{
|
||||||
var config = configData == null ? new ConfigurationDatanCore() : new ConfigurationDatanCore(configData);
|
//var config = configData == null ? new ConfigurationDatanCore() : new ConfigurationDatanCore(configData);
|
||||||
return Task.FromResult<ConfigurationData>(new ConfigurationDatanCore(configData));
|
//return Task.FromResult<ConfigurationData>(config);
|
||||||
|
return Task.FromResult<ConfigurationData>(new ConfigurationDatanCore());
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task ApplyConfiguration(JToken configJson)
|
public async Task ApplyConfiguration(JToken configJson)
|
||||||
{
|
{
|
||||||
var config = new ConfigurationDatanCore();
|
var incomingConfig = new ConfigurationDatanCore();
|
||||||
config.LoadValuesFromJson(configJson);
|
incomingConfig.LoadValuesFromJson(configJson);
|
||||||
|
|
||||||
if (config.Hungarian.Value == false && config.English.Value == false)
|
if (incomingConfig.Hungarian.Value == false && incomingConfig.English.Value == false)
|
||||||
throw new ExceptionWithConfigData("Please select atleast one language.", (ConfigurationData)config);
|
throw new ExceptionWithConfigData("Please select atleast one language.", (ConfigurationData)incomingConfig);
|
||||||
|
|
||||||
|
var loginPage = await RequestStringWithCookies(LoginUrl, string.Empty);
|
||||||
var pairs = new Dictionary<string, string> {
|
var pairs = new Dictionary<string, string> {
|
||||||
{ "nev", config.Username.Value },
|
{ "nev", incomingConfig.Username.Value },
|
||||||
{ "pass", config.Password.Value },
|
{ "pass", incomingConfig.Password.Value },
|
||||||
{"ne_leptessen_ki", "on"}
|
{ "ne_leptessen_ki", "on"}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var result = await RequestLoginAndFollowRedirect(LoginUrl, pairs, loginPage.Cookies, true, LoggedInUrl, LoggedInUrl);
|
||||||
|
ConfigureIfOK(result.Cookies, result.Content != null && result.Content.Contains("Felhasználó"), () =>
|
||||||
|
{
|
||||||
|
CQ dom = result.Content;
|
||||||
|
var messageEl = dom["#hibauzenet table tbody tr"];
|
||||||
|
var msgContainer = messageEl.Get(0).ChildElements.ElementAt(1);
|
||||||
|
var errorMessage = msgContainer != null ? msgContainer.InnerText : "Error while trying to login.";
|
||||||
|
throw new ExceptionWithConfigData(errorMessage, (ConfigurationData)incomingConfig);
|
||||||
|
});
|
||||||
|
|
||||||
var response = await webclient.GetString(new Utils.Clients.WebRequest()
|
//var configSaveData = new JObject();
|
||||||
{
|
//configSaveData["config"] = incomingConfig.ToJson();
|
||||||
Url = LoginUrl,
|
//SaveConfig(configSaveData);
|
||||||
PostData = pairs,
|
|
||||||
Referer = SiteLink.ToString(),
|
|
||||||
Type = RequestType.POST,
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!response.RedirectingTo.Equals("index.php"))
|
|
||||||
{
|
|
||||||
var errorMessage = "Couldn't login";
|
|
||||||
throw new ExceptionWithConfigData(errorMessage, (ConfigurationData)config);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var configSaveData = new JObject();
|
|
||||||
cookieHeader = response.Cookies;
|
|
||||||
|
|
||||||
cookieHeader = cookieHeader.Substring(0, cookieHeader.IndexOf(' ') - 1) + ";stilus=brutecore; nyelv=hu";
|
|
||||||
configSaveData["cookies"] = cookieHeader;
|
|
||||||
configSaveData["config"] = configData = config.ToJson();
|
|
||||||
SaveConfig(configSaveData);
|
|
||||||
IsConfigured = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
|
public async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
|
||||||
{
|
{
|
||||||
List<ReleaseInfo> releases = new List<ReleaseInfo>();
|
List<ReleaseInfo> releases = new List<ReleaseInfo>();
|
||||||
@@ -101,18 +92,10 @@ namespace Jackett.Indexers
|
|||||||
var searchString = query.SanitizedSearchTerm + " " + query.GetEpisodeSearchString();
|
var searchString = query.SanitizedSearchTerm + " " + query.GetEpisodeSearchString();
|
||||||
var episodeSearchUrl = string.Format(SearchUrl, HttpUtility.UrlEncode(searchString));
|
var episodeSearchUrl = string.Format(SearchUrl, HttpUtility.UrlEncode(searchString));
|
||||||
|
|
||||||
//var response = await webclient.GetString(new Utils.Clients.WebRequest()
|
var response = await RequestStringWithCookiesAndRetry(episodeSearchUrl);
|
||||||
//{
|
|
||||||
// Url = episodeSearchUrl,
|
|
||||||
// Cookies = cookieHeader,
|
|
||||||
// Referer = SiteLink.ToString(),
|
|
||||||
//});
|
|
||||||
|
|
||||||
// var results = response.Content;
|
|
||||||
var results= "";
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
CQ dom = results;
|
CQ dom = response.Content;
|
||||||
|
|
||||||
ReleaseInfo release;
|
ReleaseInfo release;
|
||||||
var rows = dom[".box_torrent_all"].Find(".box_torrent");
|
var rows = dom[".box_torrent_all"].Find(".box_torrent");
|
||||||
@@ -146,37 +129,36 @@ namespace Jackett.Indexers
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
//OnParseError(response.Content, ex);
|
OnParseError(response.Content, ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return releases.ToArray();
|
return releases.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
//public void LoadFromSavedConfiguration(JToken jsonConfig)
|
public override void LoadFromSavedConfiguration(JToken jsonConfig)
|
||||||
//{
|
{
|
||||||
// if (jsonConfig["config"] != null)
|
base.LoadFromSavedConfiguration(jsonConfig);
|
||||||
// {
|
//if (jsonConfig["config"] != null)
|
||||||
// string hun, eng;
|
//{
|
||||||
// Dictionary<string, string>[] configDictionary = JsonConvert.DeserializeObject<Dictionary<string, string>[]>(jsonConfig["config"].ToString());
|
// string hun, eng;
|
||||||
// configDictionary[2].TryGetValue("value", out hun);
|
// Dictionary<string, string>[] configDictionary = JsonConvert.DeserializeObject<Dictionary<string, string>[]>(jsonConfig["config"].ToString());
|
||||||
// configDictionary[3].TryGetValue("value", out eng);
|
// configDictionary[2].TryGetValue("value", out hun);
|
||||||
|
// configDictionary[3].TryGetValue("value", out eng);
|
||||||
|
|
||||||
// bool isHun = Boolean.Parse(hun);
|
// bool isHun = Boolean.Parse(hun);
|
||||||
// bool isEng = Boolean.Parse(eng);
|
// bool isEng = Boolean.Parse(eng);
|
||||||
|
|
||||||
// if (isHun && isEng)
|
// if (isHun && isEng)
|
||||||
// SearchUrl = SearchUrlEnHun;
|
// SearchUrl = SearchUrlEnHun;
|
||||||
// else if (isHun && !isEng)
|
// else if (isHun && !isEng)
|
||||||
// SearchUrl = SearchUrlHun;
|
// SearchUrl = SearchUrlHun;
|
||||||
// else if (!isHun && isEng)
|
// else if (!isHun && isEng)
|
||||||
// SearchUrl = SearchUrlEn;
|
// SearchUrl = SearchUrlEn;
|
||||||
|
|
||||||
// configData = jsonConfig["config"];
|
// configData = jsonConfig["config"];
|
||||||
// }
|
//}
|
||||||
// cookieHeader = (string)jsonConfig["cookies"];
|
}
|
||||||
// IsConfigured = true;
|
|
||||||
//}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -186,6 +186,7 @@
|
|||||||
<Compile Include="Indexers\HDTorrents.cs" />
|
<Compile Include="Indexers\HDTorrents.cs" />
|
||||||
<Compile Include="Indexers\IIndexer.cs" />
|
<Compile Include="Indexers\IIndexer.cs" />
|
||||||
<Compile Include="Indexers\ImmortalSeed.cs" />
|
<Compile Include="Indexers\ImmortalSeed.cs" />
|
||||||
|
<Compile Include="Indexers\nCore.cs" />
|
||||||
<Compile Include="Indexers\TorrentBytes.cs" />
|
<Compile Include="Indexers\TorrentBytes.cs" />
|
||||||
<Compile Include="Indexers\IPTorrents.cs" />
|
<Compile Include="Indexers\IPTorrents.cs" />
|
||||||
<Compile Include="Indexers\MoreThanTV.cs" />
|
<Compile Include="Indexers\MoreThanTV.cs" />
|
||||||
@@ -205,6 +206,7 @@
|
|||||||
<Compile Include="Indexers\Torrentz.cs" />
|
<Compile Include="Indexers\Torrentz.cs" />
|
||||||
<Compile Include="Models\CachedResult.cs" />
|
<Compile Include="Models\CachedResult.cs" />
|
||||||
<Compile Include="Models\CategoryMapping.cs" />
|
<Compile Include="Models\CategoryMapping.cs" />
|
||||||
|
<Compile Include="Models\ConfigurationDatanCore.cs" />
|
||||||
<Compile Include="Models\IndexerConfig\BmtvConfig.cs" />
|
<Compile Include="Models\IndexerConfig\BmtvConfig.cs" />
|
||||||
<Compile Include="Models\IndexerConfig\ConfigurationDataBasicLoginAnimeBytes.cs" />
|
<Compile Include="Models\IndexerConfig\ConfigurationDataBasicLoginAnimeBytes.cs" />
|
||||||
<Compile Include="Models\IndexerConfig\ConfigurationDataBasicLoginFrenchTorrentDb.cs" />
|
<Compile Include="Models\IndexerConfig\ConfigurationDataBasicLoginFrenchTorrentDb.cs" />
|
||||||
|
Reference in New Issue
Block a user