Fixed: (RuTracker) Improve the error message for failed logins

This commit is contained in:
Bogdan 2023-05-22 14:12:41 +03:00
parent 96234c0fe1
commit aafdefe2f0

View file

@ -104,7 +104,11 @@ namespace NzbDrone.Core.Indexers.Definitions
if (!response.Content.Contains("id=\"logged-in-username\""))
{
throw new IndexerAuthException("RuTracker Auth Failed");
var parser = new HtmlParser();
var document = await parser.ParseDocumentAsync(response.Content);
var errorMessage = document.QuerySelector("h4.warnColor1.tCenter.mrg_16, div.msg-main")?.TextContent.Trim();
throw new IndexerAuthException(errorMessage ?? "RuTracker Auth Failed");
}
cookies = response.GetCookies();