Exemple #1
0
        /// <summary>
        /// 头条作者新闻处理
        /// </summary>
        public static void AuthorNewsGathering()
        {
            try
            {
                if (Global.IsEnableGatherAuthor != "1")
                {
                    return;
                }
                ////时段控制 0-8点不抓取
                //if (DateTime.Now.Hour < 8)
                //{
                //    return;
                //}
                while (true)
                {
                    Log.Info("作者列表页新闻抓取开始:" + DateTime.Now);

                    var bll = new ToutiaoGather();
                    bll.GatheringNewsFromAuthor();


                    Log.Info("作者列表页新闻抓取结束:" + DateTime.Now);
                    Thread.Sleep(60 * 1000);
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex.Message + ex.StackTrace);
            }
        }
        /// <summary>
        /// 头条作者新闻处理
        /// </summary>
        public static void GatheringNewsFromAuthor()
        {
            try
            {
                if (Global.IsEnableGatherAuthor != "1")
                {
                    return;
                }
                ////时段控制 0-8点不抓取
                //if (DateTime.Now.Hour < 8)
                //{
                //    return;
                //}
                var i = 0;
                while (true && ProxyDeal.IsProxyReady)
                {
                    i++;
                    Log.Info("作者列表页新闻抓取开始 i=" + i + " time=" + DateTime.Now);

                    var bll = new ToutiaoGather();
                    bll.GatheringNewsFromAuthor();


                    Log.Info("作者列表页新闻抓取结束 i=" + i + " time=" + DateTime.Now);
                    Thread.Sleep(5 * 1000);
                }
                if (!ProxyDeal.IsProxyReady)
                {
                    Log.Info("代理未准备好" + DateTime.Now);
                    Thread.Sleep(60 * 1000);
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex.Message + ex.StackTrace);
            }
        }
 public void AuthorNewsGatheringTest()
 {
     //var t = Comm.Tools.Utility.DateTimeFormat.ToJsTime(DateTime.Now);
     bll.GatheringNewsFromAuthor();
 }