public static void Main()
var api = new OtomotoApi();
var carDetails = api.GetCarDetails("https://www.otomoto.pl/oferta/kia-niro-salon-pl-1-wl-serwis-aso-gwarancja-do-2027-roku-ID6EcBXJ.html");
Console.WriteLine(carDetails);
public OtomotoCar GetCarDetails(string url)
var productionDate = doc.DocumentNode.SelectSingleNode("//span[text()='Rok produkcji']/following-sibling::div/text()");
var price = doc.DocumentNode.SelectSingleNode("//span[@class='offer-price__number']/text()");
var title = doc.DocumentNode.SelectSingleNode("//span[@class='offer-title big-text fake-title']");
Title = title.InnerText.Trim(),
ProductionYear = Convert.ToInt32(productionDate.InnerText),
Price = Convert.ToDecimal(price.InnerText.RemoveNonDigits())
public string Url {get; set;}
public int ProductionYear {get; set;}
public decimal Price {get; set;}
public string Title {get; set;}
public override string ToString()
var sb = new StringBuilder();
sb.Append("Url: ").Append(Url).AppendLine();
sb.Append("Tytuł: ").Append(Title).AppendLine();
sb.Append("Data produkcji: ").Append(ProductionYear).AppendLine();
sb.Append("Cena: ").Append(Price).AppendLine();
public static class StringUtils
public static string RemoveNonDigits(this string input)
return new String(input.Where(Char.IsDigit).ToArray());