Przeglądaj źródła

队列模式无限翻页调整

maxiaoshan 3 lat temu
rodzic
commit
7929a6a5ac
1 zmienionych plików z 10 dodań i 6 usunięć
  1. 10 6
      src/spider/spider.go

+ 10 - 6
src/spider/spider.go

@@ -271,11 +271,15 @@ func (s *Spider) DownListPageItem() (errs interface{}) {
 	if util.Config.IsHistoryEvent && s.GetVar("spiderType") == "history" {     //7000节点,爬虫跑历史
 		max = s.GetIntVar("spiderHistoryMaxPage")
 	}
-	downtimes := 0                                                                  //记录某页重试次数(暂定3次)
-	repeatPageNum := 0                                                              //记录列表页所有连接重复的页码
-	repeatPageTimes := 0                                                            //记录页码连续判重的次数(暂定连续判重页码数为5次时,不再翻页)
-	isRunRepeatList := false                                                        //是否执行列表页连续判重
-	if util.Config.Modal == 1 && util.Config.Working == 0 && max > 1 && max < 101 { //7100 7400最大页小于101且大于1,对此部分爬虫采集列表页时进行连续5页判重
+	downtimes := 0             //记录某页重试次数(暂定3次)
+	repeatPageNum := 0         //记录列表页所有连接重复的页码
+	repeatPageTimes := 0       //记录页码连续判重的次数(暂定连续判重页码数为5次时,不再翻页)
+	repeatPageTimesLimit := 10 //记录页码连续判重的次数上线(高性能模式10页,队列模式5页)
+	if util.Config.Working == 1 {
+		repeatPageTimesLimit = 5
+	}
+	isRunRepeatList := false                            //是否执行列表页连续判重
+	if util.Config.Modal == 1 && max > 1 && max < 101 { //除顺序采集模式外所有节点,采集列表页时进行连续10页判重
 		isRunRepeatList = true
 		max = 100 //设置最大页为100
 	}
@@ -287,7 +291,7 @@ func (s *Spider) DownListPageItem() (errs interface{}) {
 		//if start > tmpMax && isRunRepeatList && repeatPageTimes >= 5 { //重复次数超过5次,不再翻页
 		//	break
 		//}
-		if isRunRepeatList && repeatPageTimes >= 10 { //重复次数超过10次,不再翻页
+		if isRunRepeatList && repeatPageTimes >= repeatPageTimesLimit { //重复次数超过10次,不再翻页
 			break
 		}
 		if err := s.L.CallByParam(lua.P{