Skip to content

Commit

Permalink
fix iprbook
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleg Koloskov committed Oct 31, 2023
1 parent 70b48db commit 670e21f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Common/Parser.Core/DefaultRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
namespace Parser.Core;

public class DefaultRunner {
public static async Task Run<TParser, TOptions>(string[] args) where TParser : ParserBase where TOptions : OptionsBase {
await CommandLine.Parser.Default.ParseArguments<TOptions>(args)
public static Task Run<TParser, TOptions>(string[] args) where TParser : ParserBase where TOptions : OptionsBase {
return CommandLine.Parser.Default.ParseArguments<TOptions>(args)
.WithParsedAsync(async options => {
var kernel = new StandardKernel(new CoreNinjectModule(options));
await kernel.Get<TParser>().Run();
Expand Down
11 changes: 5 additions & 6 deletions Parsers/IprBookShop.Parser/Logic/Parser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,14 @@ private async Task<BookInfo> 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;
Expand Down

0 comments on commit 670e21f

Please sign in to comment.