コード例 #1
0
        public void GatherNewsFromZtRecentTest()
        {
            var url0 = "http://toutiao.com/group/6353545386958782977/";
            var str  = Global.GetToutiaoGroupId(url0);

            var url = "http://www.toutiao.com/api/article/recent/?source=2&count=20&category=%E7%BB%84%E5%9B%BE&max_behot_time=0&utm_source=toutiao&device_platform=web&offset=0&as=A1B508A27D30C8F&cp=582D607C78CFCE1&_=1479347343375";

            bll.GatherNewsFromZtRecent(url, 0);
        }
コード例 #2
0
        /// <summary>
        /// 从组图列表抓取作者信息
        /// </summary>
        public static void GatherNewsFromZtRecent()
        {
            try
            {
                if (Global.IsEnableGatherZt != "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();
                    var url = "http://www.toutiao.com/api/article/recent/?source=2&count=20&category=%E7%BB%84%E5%9B%BE&max_behot_time=0&utm_source=toutiao&device_platform=web&offset=0&as=A1B508A27D30C8F&cp=582D607C78CFCE1&_=1479347343375";
                    bll.GatherNewsFromZtRecent(url, 0);


                    Log.Info("从组图列表抓相关新闻的作者结束 i=" + i + " time=" + DateTime.Now);
                    Thread.Sleep(60 * 1000);
                }
                if (!ProxyDeal.IsProxyReady)
                {
                    Log.Info("代理未准备好" + DateTime.Now);
                    Thread.Sleep(60 * 1000);
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex.Message + ex.StackTrace);
            }
        }