wangkun %!s(int64=2) %!d(string=hai) anos
pai
achega
191a0d674a
Modificáronse 2 ficheiros con 6 adicións e 6 borrados
  1. 5 5
      main/gzh.py
  2. 1 1
      main/run_gzh.py

+ 5 - 5
main/gzh.py

@@ -178,8 +178,8 @@ class GZH:
                 cls.begin += 5
                 if 'app_msg_list' not in r.json() or len(r.json()['app_msg_list']) == 0:
                     Common.logger(log_type).warning("get_gzh_url:response:{}\n", r.text)
-                    Common.logger(log_type).info('休眠 1 分钟')
-                    time.sleep(60 * 1)
+                    Common.logger(log_type).info('休眠 3 - 60 分钟')
+                    time.sleep(random.randint(60*3, 60*60))
                     break
                 else:
                     app_msg_list = r.json()['app_msg_list']
@@ -276,7 +276,7 @@ class GZH:
                                 cls.gzh_count = []
                                 return
 
-                time.sleep(60*1)
+                time.sleep(60*3)
             except Exception as e:
                 Common.logger(log_type).error("get_gzh_url异常:{}\n", e)
 
@@ -291,8 +291,8 @@ class GZH:
                 head_url = user_sheet[i][3]
                 Common.logger(log_type).info("获取 {} 公众号文章\n", username)
                 cls.get_gzh_url(log_type, username, userid, head_url)
-                Common.logger(log_type).info("休眠 10 分钟")
-                time.sleep(60*5)
+                Common.logger(log_type).info("休眠 3 - 60 分钟")
+                time.sleep(random.randint(60*3, 60*60))
         except Exception as e:
             Common.logger(log_type).error("get_all_gzh异常:{}\n", e)
 

+ 1 - 1
main/run_gzh.py

@@ -14,7 +14,7 @@ class Main:
     @classmethod
     def main(cls, env):
         while True:
-            if 18 >= datetime.datetime.now().hour >= 8:
+            if 17 >= datetime.datetime.now().hour >= 9:
                 # # 获取用户及 ID 信息
                 # Common.logger('gzh').info("今日公众号抓取任务开始\n")
                 # GZH.search_user_by_word('gzh')