Esempio n. 1
0
        /// <summary>
        ///     重新下载 代理列表
        /// </summary>
        /// <remarks>
        ///     调用程序定期调用本方法下载最新的代理列表
        /// </remarks>
        public static void ReDownLoadWebProxyList()
        {
            AbstractSpider spider = new ProxycnSpider
            {
                BeginPageNumber = 1,
                EndPageNumber   = 30 //下载30页
            };
            var nList = spider.ResultArticleList;

            //spider.WriteToTxt(Path.Combine(Directory.GetCurrentDirectory(),
            //                                   string.Format("{0}-{1}.txt", spider.Site.Name, DateTime.Now.ToShortDateString())));

            if (nList == null || nList.Count == 0)
            {
                Log.Info("ReDownLoadWebProxyList-NULL");
                return;
            }
            var cList = CheckAllWebProxy(nList);

            if (cList.Count > 0)
            {
                XmlSerializeHelper.SerializeToXml(s_Config_ProxyIPConfigPath, cList);
                _webProxyIPList = cList;
                Log.InfoFormat("ReDownLoadWebProxyList-Checked-UPDATE-Num:{0}", cList.Count);
            }
            else
            {
                Log.Info("ReDownLoadWebProxyList-Checked-NULL");
            }
        }