public bool IsTermination(Page page, BaseTargetUrlsBuilder builder)
        {
            if (page == null || string.IsNullOrEmpty(page.Content))
            {
                return(false);
            }

            return(!Contents.All(c => page.Content.Contains(c)));
        }
        public bool IsTermination(Page page, BaseTargetUrlsBuilder builder)
        {
            if (page == null || string.IsNullOrEmpty(page.Content))
            {
                return(false);
            }
            var current      = builder.GetCurrentPagger(page.Request.Method == HttpMethod.Get ? page.Url : page.Request.PostBody);
            int currentIndex = int.Parse(RegexUtil.NumRegex.Match(current).Value);

            return(currentIndex >= Limit);
        }
Exemple #3
0
        public bool IsTermination(Page page, BaseTargetUrlsBuilder creator)
        {
            if (TotalPageSelector == null || CurrenctPageSelector == null)
            {
                throw new SpiderException("Total page selector or current page selector should not be null.");
            }
            if (string.IsNullOrEmpty(page?.Content))
            {
                return(false);
            }
            var totalStr   = GetSelectorValue(page, TotalPageSelector);
            var currentStr = GetSelectorValue(page, CurrenctPageSelector);

            return(currentStr == totalStr);
        }