예제 #1
0
 public void Process(Page page)
 {
     if ((from subPageProcessor in _subPageProcessors where subPageProcessor.Match(page.GetRequest()) select subPageProcessor.ProcessPage(page)).Any(matchOtherProcessorProcessor => matchOtherProcessorProcessor != MatchOther.Yes))
     {
     }
 }
예제 #2
0
        /// <summary>
        /// ����Ҳ����򲻷���URL, ��Ȼ���ص�URL̫��
        /// </summary>
        /// <param name="page"></param>
        /// <param name="urlRegionSelector"></param>
        /// <param name="urlPatterns"></param>
        private void ExtractLinks(Page page, ISelector urlRegionSelector, IList<Regex> urlPatterns)
        {
            var links = urlRegionSelector == null ? new List<string>() : page.GetHtml().SelectList(urlRegionSelector).Links().GetAll();

            if (urlPatterns == null || urlPatterns.Count == 0)
            {
                page.AddTargetRequests(links);
                return;
            }

            foreach (Regex targetUrlPattern in urlPatterns)
            {
                foreach (string link in links)
                {
                    if (targetUrlPattern.IsMatch(link))
                    {
                        page.AddTargetRequest(new Request(link, page.GetRequest().Extras));
                    }
                }
            }
        }