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); }
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); }
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); }