/// <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; }
/// <summary> /// 向列表页规则传递参数,并返回提示数据 /// </summary> /// <param name="project"></param> /// <param name="parameter"></param> /// <returns></returns> public virtual string Invoke_ListPage(Project project, object parameter) { string returnData; int i = 0; object obj = String.Empty; project.UseMultiThread = true; project.InvokeList(parameter, 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); }
/// <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); }
public override string Invoke_ListPage(Project project, string listPageUri) { project.UseMultiThread = true; //重置计数 project.ResetState(); int categoryId = int.Parse(request.Form["category"]); if (categoryId == -1) return "<strong>错误,请先选择采集目标栏目!<strong><br />"; project.InvokeList(listPageUri, GetDataPackHandler(categoryId)); return String.Format("任务总数:{0},成功:{1},失败:{2}", project.State.TotalCount, project.State.SuccessCount, project.State.FailCount); }
/// <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; }