Bläddra i källkod

Merge branch 'master' of https://git.yishihui.com/Server/piaoquan_crawler

lierqiang 2 år sedan
förälder
incheckning
15be031968
1 ändrade filer med 11 tillägg och 2 borttagningar
  1. 11 2
      gongzhonghao/gongzhonghao_follow/gongzhonghao_follow.py

+ 11 - 2
gongzhonghao/gongzhonghao_follow/gongzhonghao_follow.py

@@ -119,6 +119,11 @@ class GongzhonghaoFollow:
                     Common.logger(log_type, crawler).warning(f"get_gzh_url:{r.text}\n")
                     Feishu.bot(log_type, crawler, "token过期啦,请扫码更换\nhttps://mp.weixin.qq.com/")
                     time.sleep(60 * 10)
+                elif r.json()["base_resp"]["err_msg"] == "freq control" and 21 >= datetime.datetime.now().hour >= 10:
+                    Common.logger(log_type, crawler).info(f"status_code:{r.status_code}")
+                    Common.logger(log_type, crawler).warning(f"get_gzh_url:{r.text}\n")
+                    Feishu.bot(log_type, crawler, "公众号频控啦,请扫码更换\nhttps://mp.weixin.qq.com/")
+                    time.sleep(60 * 10)
                 else:
                     break
             if "list" not in r.json() or len(r.json()["list"]) == 0:
@@ -229,12 +234,16 @@ class GongzhonghaoFollow:
                 urllib3.disable_warnings()
                 r = requests.get(url=url, headers=headers, params=params, verify=False)
                 while True:
-                    if r.json()["base_resp"][
-                        "err_msg"] == "invalid session" and 21 >= datetime.datetime.now().hour >= 10:
+                    if r.json()["base_resp"]["err_msg"] == "invalid session" and 21 >= datetime.datetime.now().hour >= 10:
                         Common.logger(log_type, crawler).info(f"status_code:{r.status_code}")
                         Common.logger(log_type, crawler).info(f"response:{r.text}")
                         Feishu.bot(log_type, crawler, "token过期啦,请扫码更换\nhttps://mp.weixin.qq.com/")
                         time.sleep(60 * 10)
+                    elif r.json()["base_resp"]["err_msg"] == "freq control" and 21 >= datetime.datetime.now().hour >= 10:
+                        Common.logger(log_type, crawler).info(f"status_code:{r.status_code}")
+                        Common.logger(log_type, crawler).warning(f"get_gzh_url:{r.text}\n")
+                        Feishu.bot(log_type, crawler, "公众号频控啦,请扫码更换\nhttps://mp.weixin.qq.com/")
+                        time.sleep(60 * 10)
                     else:
                         break
                 if 'app_msg_list' not in r.json():