From 670e21fd614025045f1f5e44927cd9dfeba9be9c Mon Sep 17 00:00:00 2001 From: Oleg Koloskov Date: Tue, 31 Oct 2023 13:34:50 +0300 Subject: [PATCH] fix iprbook --- Common/Parser.Core/DefaultRunner.cs | 4 ++-- Parsers/IprBookShop.Parser/Logic/Parser.cs | 11 +++++------ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/Common/Parser.Core/DefaultRunner.cs b/Common/Parser.Core/DefaultRunner.cs index 615637e..1e74af3 100644 --- a/Common/Parser.Core/DefaultRunner.cs +++ b/Common/Parser.Core/DefaultRunner.cs @@ -8,8 +8,8 @@ namespace Parser.Core; public class DefaultRunner { - public static async Task Run(string[] args) where TParser : ParserBase where TOptions : OptionsBase { - await CommandLine.Parser.Default.ParseArguments(args) + public static Task Run(string[] args) where TParser : ParserBase where TOptions : OptionsBase { + return CommandLine.Parser.Default.ParseArguments(args) .WithParsedAsync(async options => { var kernel = new StandardKernel(new CoreNinjectModule(options)); await kernel.Get().Run(); diff --git a/Parsers/IprBookShop.Parser/Logic/Parser.cs b/Parsers/IprBookShop.Parser/Logic/Parser.cs index b2f3645..143e817 100644 --- a/Parsers/IprBookShop.Parser/Logic/Parser.cs +++ b/Parsers/IprBookShop.Parser/Logic/Parser.cs @@ -65,15 +65,14 @@ private async Task GetBook(HttpClient client, long id) { return default; } - var bookInfoBlock = doc.DocumentNode.GetByFilterFirst("div", "book-information"); + var bookInfoBlock = doc.DocumentNode.GetByFilterFirst("div", "row-book"); var book = new BookInfo(id.ToString(), ElsName) { - Name = Normalize(bookInfoBlock?.GetByFilterFirst("h4", "header-orange")?.InnerText), - Bib = Normalize(bookInfoBlock?.GetByFilter("p", "book-description")?.LastOrDefault()?.InnerText) + Name = Normalize(bookInfoBlock?.GetByFilterFirst("h4", "mb-5")?.InnerText), + Bib = Normalize(doc.DocumentNode?.GetByFilter("p", "book-description")?.LastOrDefault()?.InnerText) }; - - var bookDescriptionBlock = bookInfoBlock.GetByFilterFirst("div", "col-sm-10") ?? bookInfoBlock.GetByFilterFirst("div", "col-sm-9"); - foreach (var row in bookDescriptionBlock.GetByFilter("div", "row")) { + + foreach (var row in doc.DocumentNode.GetByFilter("div", "row")) { var strong = row.Descendants().FirstOrDefault(t => t.Name == "strong"); if (strong == default || string.IsNullOrWhiteSpace(strong.InnerText)) { continue;