示例#1
0
        public async Task <List <string> > GetPricesAds()
        {
            var htmlDocument       = new HtmlAgilityPack.HtmlDocument();
            var parsePricesAdsData = new List <string>();
            await Task.Run(() =>
            {
                for (int i = 0; i < ContentCollection.Count; i++)
                {
                    htmlDocument.LoadHtml(ContentCollection[i]);
                    HtmlNodeCollection nodeAds = htmlDocument.DocumentNode.SelectNodes("//div[@class='space inlblk rel']/p[@class='price']/strong");

                    if (nodeAds != null)
                    {
                        for (var k = 0; k < nodeAds.Count; k++)
                        {
                            PricesCollection.Add(nodeAds[k].InnerText);
                            parsePricesAdsData.Add(nodeAds[k].InnerText);
                            //PricesCollection.Add();
                        }
                    }
                }
            });

            return(parsePricesAdsData);
        }
示例#2
0
 public void Dispose()
 {
     Response.Dispose();
     ContentCollection.Clear();
     AdsCollection.Clear();
     PricesCollection.Clear();
     LocationCollection.Clear();
     PublishingTimeCollection.Clear();
     IndividualAdsUrlsCollection.Clear();
     IndividualAdsNamesCollection.Clear();
 }