Ejemplo n.º 1
0
        /// <summary>
        /// 从新闻页抓取作者信息
        /// </summary>
        public static void GatherAuthorFromNews()
        {
            try
            {
                if (Global.IsEnableGatherAuthorFromNews != "1")
                {
                    return;
                }
                ////时段控制 0-8点不抓取
                //if (DateTime.Now.Hour < 8)
                //{
                //    return;
                //}
                while (true)
                {
                    Log.Info("从新闻页抓取作者开始:" + DateTime.Now);

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


                    Log.Info("从新闻页抓取作者结束:" + DateTime.Now);
                    Thread.Sleep(60 * 1000);
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex.Message + ex.StackTrace);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 从新闻页抓取作者信息
        /// 同时会抓取这个新闻的评论列表,从评论列表抓取用户,再从用户这里抓取用户订阅的作者
        /// 要多开
        /// </summary>
        public static void GatherAuthorFromNews()
        {
            try
            {
                if (Global.IsEnableGatherAuthorFromNews != "1")
                {
                    return;
                }
                ////时段控制 0-8点不抓取
                //if (DateTime.Now.Hour < 8)
                //{
                //    return;
                //}
                int i = 0;
                while (true && ProxyDeal.IsProxyReady)
                {
                    i++;
                    Log.Info("从新闻页抓取作者开始 i=" + i + " time=" + DateTime.Now);

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


                    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 GatherAuthorFromNewsTest()
 {
     bll.GatherAuthorFromNews();
 }