mirror of https://github.com/Jackett/Jackett
hdtorrents: add error message selector
This commit is contained in:
parent
207dd1d51a
commit
3a9360add9
|
@ -133,27 +133,37 @@ namespace Jackett.Common.Indexers
|
||||||
var result = await RequestLoginAndFollowRedirect(LoginUrl, pairs, loginPage.Cookies, true, null, LoginUrl);
|
var result = await RequestLoginAndFollowRedirect(LoginUrl, pairs, loginPage.Cookies, true, null, LoginUrl);
|
||||||
|
|
||||||
await ConfigureIfOK(
|
await ConfigureIfOK(
|
||||||
result.Cookies, result.ContentString?.Contains("If your browser doesn't have javascript enabled") == true,
|
result.Cookies, result.ContentString?.Contains("If your browser doesn't have javascript enabled") == true, () =>
|
||||||
() => throw new ExceptionWithConfigData("Couldn't login", configData));
|
{
|
||||||
|
var parser = new HtmlParser();
|
||||||
|
var dom = parser.ParseDocument(result.ContentString);
|
||||||
|
|
||||||
|
var errorMessage = dom.QuerySelector("div > font[color=\"#FF0000\"]")?.TextContent.Trim();
|
||||||
|
|
||||||
|
throw new ExceptionWithConfigData(errorMessage ?? "Couldn't login", configData);
|
||||||
|
});
|
||||||
|
|
||||||
return IndexerConfigurationStatus.RequiresTesting;
|
return IndexerConfigurationStatus.RequiresTesting;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
|
protected override async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query)
|
||||||
{
|
{
|
||||||
var releases = new List<ReleaseInfo>();
|
var releases = new List<ReleaseInfo>();
|
||||||
var searchUrl = SearchUrl + string.Join(
|
|
||||||
string.Empty, MapTorznabCapsToTrackers(query).Select(cat => $"category[]={cat}&"));
|
var searchUrl = SearchUrl + string.Join(string.Empty, MapTorznabCapsToTrackers(query).Select(cat => $"category[]={cat}&"));
|
||||||
|
|
||||||
var queryCollection = new NameValueCollection
|
var queryCollection = new NameValueCollection
|
||||||
{
|
{
|
||||||
{"search", query.ImdbID ?? query.GetQueryString()},
|
{ "search", query.ImdbID ?? query.GetQueryString() },
|
||||||
{"active", ((BoolConfigurationItem)configData.GetDynamic("freeleech")).Value ? "5" : "0"},
|
{ "active", ((BoolConfigurationItem)configData.GetDynamic("freeleech")).Value ? "5" : "0" },
|
||||||
{"options", "0"}
|
{ "options", "0" }
|
||||||
};
|
};
|
||||||
|
|
||||||
// manually url encode parenthesis to prevent "hacking" detection, remove . as not used in titles
|
// manually url encode parenthesis to prevent "hacking" detection, remove . as not used in titles
|
||||||
searchUrl += queryCollection.GetQueryString().Replace("(", "%28").Replace(")", "%29").Replace(".", " ");
|
searchUrl += queryCollection.GetQueryString().Replace("(", "%28").Replace(")", "%29").Replace(".", " ");
|
||||||
|
|
||||||
var results = await RequestWithCookiesAndRetryAsync(searchUrl);
|
var results = await RequestWithCookiesAndRetryAsync(searchUrl);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var parser = new HtmlParser();
|
var parser = new HtmlParser();
|
||||||
|
@ -167,7 +177,10 @@ namespace Jackett.Common.Indexers
|
||||||
foreach (var row in rows.Skip(1))
|
foreach (var row in rows.Skip(1))
|
||||||
{
|
{
|
||||||
if (row.Children.Length == 2)
|
if (row.Children.Length == 2)
|
||||||
continue; // fix bug with search: cohen
|
{
|
||||||
|
// fix bug with search: cohen
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
var mainLink = row.Children[2].QuerySelector("a");
|
var mainLink = row.Children[2].QuerySelector("a");
|
||||||
var title = mainLink.TextContent;
|
var title = mainLink.TextContent;
|
||||||
|
|
Loading…
Reference in New Issue