浏览代码

常规版本,subhd 的搜索间隔调整为 30 - 40s

Signed-off-by: 716 <[email protected]>
716 3 年之前
父节点
当前提交
f8cb29270d
共有 1 个文件被更改,包括 7 次插入1 次删除
  1. 7 1
      internal/logic/sub_supplier/subhd/subhd.go

+ 7 - 1
internal/logic/sub_supplier/subhd/subhd.go

@@ -36,6 +36,7 @@ type Supplier struct {
 	topic       int
 	rodLauncher *launcher.Launcher
 	tt          time.Duration
+	debugMode   bool
 }
 
 func NewSupplier(_reqParam ...types.ReqParam) *Supplier {
@@ -52,6 +53,7 @@ func NewSupplier(_reqParam ...types.ReqParam) *Supplier {
 
 	// 默认超时是 2 * 60s,如果是调试模式则是 5 min
 	sup.tt = common.HTMLTimeOut
+	sup.debugMode = sup.reqParam.DebugMode
 	if sup.reqParam.DebugMode == true {
 		sup.tt = common.OneVideoProcessTimeOut
 	}
@@ -667,7 +669,11 @@ func (s Supplier) httpGetFromBrowser(browser *rod.Browser, inputUrl string) (str
 		return "", nil, err
 	}
 	// 每次搜索间隔在 30-40s
-	time.Sleep(my_util.RandomSecondDuration(5, 10))
+	if s.debugMode == true {
+		time.Sleep(my_util.RandomSecondDuration(5, 10))
+	} else {
+		time.Sleep(my_util.RandomSecondDuration(30, 40))
+	}
 
 	return pageString, page, nil
 }