Proxycn 代理中国 HTTP 代理列表 下载器 全文页面: 首 http://www.proxycn.com/html_proxy/http-1.html 末 http://www.proxycn.com/html_proxy/http-62.html
상속: AbstractSpider
예제 #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");
            }
        }
예제 #2
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)
            {
                LogManager.Instance.Info("ReDownLoadWebProxyList-NULL");
                return;
            }
            var cList = CheckAllWebProxy(nList);
            if (cList.Count > 0)
            {
                XmlSerializeHelper.SerializeToXml(s_Config_ProxyIPConfigPath, cList);
                _webProxyIPList = cList;
                LogManager.Instance.Info("ReDownLoadWebProxyList-Checked-UPDATE-Num:{0}", cList.Count);
            }
            else
                LogManager.Instance.Info("ReDownLoadWebProxyList-Checked-NULL");
        }