Example #1
0
        public async Task Parse()
        {
            string source;

            if (isUrl)
            {
                source = await _loader.GetPage();
            }
            else
            {
                source = Source;
            }
            Console.WriteLine("loader");
            var domParser = new AngleSharp.Parser.Html.HtmlParser();
            var document  = await domParser.ParseAsync(source);

            Console.WriteLine("parser");
            _result = await _parser.Parse(document);

            ParsingCompleted?.Invoke(this, new ParseResult <Dictionary <string, List <StringDictionary> > >()
            {
                Res = _result
            });
            //OnNewData?.Invoke(this, result);
        }
Example #2
0
        public async Task <T> Work(ILoader loader)
        {
            string source = await loader.GetPage();                               //gettin page

            TreatErrors(source);                                                  //error check
            HtmlParser    domParser = new HtmlParser();                           //anglesharp domparser
            IHtmlDocument doc       = await domParser.ParseDocumentAsync(source); //parsin url so anglesharp can read it

            var result = Parser.Parse(doc);                                       //parsin url so WE can read it

            return(result);
        }
Example #3
0
 public void GetPage(IUrl url, string pendingXPath = null)
 {
     Appeals++;
     _document = null;
     FileName  = Converting(url.Get());
     if (Urls.Contains(FileName) && File.Exists(FullPath))
     {
         _document = Load();
         if (_document != null)
         {
             return;
         }
     }
     Downloads++;
     _loader.GetPage(url, pendingXPath);
 }