private IEnumerable<UrlLinkInfo> GetDetailLinkUrls(string detailLinkUrlXPath, IPagingStrategy paging, int maxEntries)
        {
            var result = new UniqueAndItemsLimitAwareUrlInfoCollection(maxEntries);

            var detailLinkDefinition = new Dictionary<string, string> { { "detailLink", detailLinkUrlXPath } };

            IHtmlParser parser;
            do
            {
                var urlToProcess = paging.CurrentPageUrl;

                var htmlContent = GetHtmlContent(urlToProcess);
                InitParser(out parser, htmlContent);

                var scrappedLinks =
                    ScrapeFields(detailLinkDefinition, parser)
                        .SelectMany(f => f.Value)
                        .ToUrlLinkInfos();

                result.AddRange(scrappedLinks);

            } while (paging.MoveNext(parser) && !result.MaxLimitReached);

            return result;
        }
Beispiel #2
0
 public PagedNewsAggregator(INewsSourceRegistry <NewsSource> registry, ICrossSourceAggregationStrategy aggregationStrategy, IPagingStrategy pagingStrategy)
 {
     _newsSources = registry.GetNewsSources();
     registry.OnSourceRegistered   += Registry_OnSourceRegistered;
     registry.OnSourceUnregistered += Registry_OnSourceUnregistered;
     _aggregationStrategy           = aggregationStrategy;
     _pagingStrategy = pagingStrategy;
 }
 public SqlValueSetCodeRepository(
     SharedContext sharedContext,
     Lazy <ClientTermContext> clientTermContext,
     ILogger logger,
     IPagingStrategy <ValueSetCodeDto, IValueSetCode> pagingStrategy)
 {
     this.SharedContext     = sharedContext;
     this.clientTermContext = clientTermContext;
     this.Logger            = logger;
     this.pagingStrategy    = pagingStrategy;
 }
Beispiel #4
0
 public SqlValueSetRepository(
     SharedContext sharedContext,
     Lazy <ClientTermContext> clientTermContext,
     IMemoryCacheProvider cache,
     ILogger logger,
     IValueSetCodeRepository valsetCodeRepository,
     IPagingStrategy <ValueSetDescriptionDto, IValueSet> pagingStrategy,
     IIsCustomValueStrategy isCustomValueStrategy)
 {
     this.clientTermContext      = clientTermContext;
     this.SharedContext          = sharedContext;
     this.Logger                 = logger;
     this.valueSetCodeRepository = valsetCodeRepository;
     this.Cache          = cache;
     this.pagingStrategy = pagingStrategy;
     this.isCustomValue  = isCustomValueStrategy;
 }