Example #1
0
        /// <summary>
        ///根据列表页的地址采集页面,并返回提示数据
        /// </summary>
        /// <param name="project"></param>
        /// <param name="listPageUri"></param>
        /// <returns></returns>
        public virtual string Invoke_ListPage(Project project, string listPageUri)
        {
            string returnData;

            int i = 0;
            object obj = String.Empty;

            project.UseMultiThread = true;

            project.InvokeList(listPageUri, dp =>
            {
                lock (obj)
                {
                    ++i;
            #if DEBUG
                    saveLog(String.Format("采集到第{0}条->{1}", i, dp["title"]));
            #endif
                }
            });

            returnData = String.Format("任务总数:{0},成功:{1},失败:{2}", project.State.TotalCount, project.State.SuccessCount,
                project.State.FailCount);

            //重置计数
            project.ResetState();

            return returnData;
        }
Example #2
0
        /// <summary>
        /// 采集单页,并返回提示数据
        /// </summary>
        /// <param name="project"></param>
        /// <param name="pageUri"></param>
        public virtual string Invoke_SinglePage(Project project, string pageUri)
        {
            project.InvokeSingle(pageUri, dp =>
            {
            #if DEBUG
                saveLog("\r\n----------------------------------------\r\n标题:"+dp["title"] + "<br />\r\n内容:" + dp["content"]+"\r\n");
            #endif
            });

            //重置计数
            project.ResetState();

            return null;
        }