Esempio n. 1
0
        public void Producer()
        {
            //todo: check for NullReferance exception
            //todo: remove all strings to const
            var htmlDoc = _webHtmlReader.Read(ITEM_URL);

            //Console.WriteLine(htmlContent.InnerText);
            var htmlContent = htmlDoc.DocumentNode.SelectNodes("//div[@class='content']//div[contains(@class,'row row-tall mt4') or contains(@class,'row-gray')]");

            var league = new League();
            var date   = new DateTime();

            foreach (var html in htmlContent)
            {
                var isCopetitionNode   = html.Attributes["class"].Value.Contains("row-gray");
                var htmlNodeCollection = html.ChildNodes;
                if (isCopetitionNode)
                {
                    var competition = GetCompetition(date, league, htmlNodeCollection);

                    Notify(competition);

                    var tryAddCompetition = _competitions.TryAdd(competition);
                }
                else
                {
                    date = GetLeagueAndDate(html, league);

                    NotifyLeague(league, date);
                }
            }
        }
        public async void Producer()
        {
            var htmlContent = _webHtmlReader.Read("https://futbolme.com/");

            throw new NotImplementedException();
        }