public IDictionary <string, int> Brands() { if (brands != null) { return(brands); } string page = client.DownloadString(avUrl); brands = ParsingRegexHelper.AllBrand(page); return(brands); }
private IEnumerable <CarDetails> GetCarDetailsByUrl(string url) { var list = new List <CarDetails>(); var html = client.DownloadString(url); var count = ParsingRegexHelper.Count(html); var names = ParsingRegexHelper.Names(html); var brands = ParsingRegexHelper.Brands(html); var titles = ParsingRegexHelper.Titles(html); var hrefs = ParsingRegexHelper.Hrefs(html); var years = ParsingRegexHelper.Years(html); var volumes = ParsingRegexHelper.Volumes(html); var prices = ParsingRegexHelper.Prices(html); var kmAges = ParsingRegexHelper.KmAges(html); var imageHrefs = ParsingRegexHelper.ImageHrefs(html); for (int i = 0; i < count; i++) { list.Add(new CarDetails() { Brand = brands[i], Name = names[i], Year = years[i], Volume = volumes[i], KmAge = kmAges[i], Href = hrefs[i], Title = titles[i], ImageHref = imageHrefs[i], State = CarState.New, PricesHistrory = new List <int>() { prices[i] } }); } return(list); }
public IDictionary <string, int> Models(string brandName) { string page = client.DownloadString(string.Format(avModelPattern, Brands()[brandName])); return(ParsingRegexHelper.AllModels(page)); }