Ejemplo n.º 1
0
        public async Task <IEnumerable <string> > Handle(GetLinksRequest request, CancellationToken cancellationToken)
        {
            var getParsingOptionsRequest = new GetParsingOptionsRequest(request.TagOptions);
            var parsingRules             = await _mediator.Send(getParsingOptionsRequest, cancellationToken);

            var parseTagsRequest = new ParseTagsRequest(parsingRules.TagsParsers, request.HtmlDocument);
            var links            = await _mediator.Send(parseTagsRequest, cancellationToken);

            var filterLinksRequest = new FilterLinksRequest(links, parsingRules);
            var filteredLinks      = (await _mediator.Send(filterLinksRequest, cancellationToken)).ToList();

            return(filteredLinks);
        }
 public async Task <IEnumerable <string> > Handle(FilterLinksRequest request, CancellationToken cancellationToken)
 {
     return(_linksListFilters.Aggregate(request.Links, (current, linksListFilter) => linksListFilter.ApplyFilter(current, request.ParsingOptions)));
 }