Ver código fonte

Merge branch 'master' into wangkun

wangkun 2 anos atrás
pai
commit
6702ce3995

+ 24 - 29
gongzhonghao/gongzhonghao_follow/gongzhonghao_follow.py

@@ -118,32 +118,29 @@ class GongzhonghaoFollow:
                 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).warning(f"get_gzh_url:{r.text}\n")
-                    Feishu.bot(log_type, crawler, "token_1过期啦,请扫码更换token\nhttps://mp.weixin.qq.com/")
+                    # Feishu.bot(log_type, crawler, "token_1过期啦,请扫码更换token\nhttps://mp.weixin.qq.com/")
                     time.sleep(60 * 10)
                     os.system("ps aux | grep run_gongzhonghao_follow.py | grep -v grep | awk '{print $2}' | xargs kill -9")
                 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, "公众号_1频控啦,请扫码更换其他公众号token\nhttps://mp.weixin.qq.com/")
+                    # Feishu.bot(log_type, crawler, "公众号_1频控啦,请扫码更换其他公众号token\nhttps://mp.weixin.qq.com/")
                     time.sleep(60 * 10)
                     os.system("ps aux | grep run_gongzhonghao_follow.py | grep -v grep | awk '{print $2}' | xargs kill -9")
+                elif "list" not in r.json() or len(r.json()["list"]) == 0 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, "公众号_1频控啦,请扫码更换其他公众号token\nhttps://mp.weixin.qq.com/")
+                    time.sleep(60 * 10)
+                    os.system(
+                        "ps aux | grep run_gongzhonghao_follow.py | grep -v grep | awk '{print $2}' | xargs kill -9")
                 else:
                     break
-            if "list" not in r.json() or len(r.json()["list"]) == 0:
-                Common.logger(log_type, crawler).info(f"status_code:{r.status_code}")
-<<<<<<< HEAD
-                Common.logger(log_type, crawler).warning(f"get_gzh_url:{r.text}\n")
-=======
->>>>>>> 10469649fb8e3a7c21407a8a53956e879cd35721
-                Feishu.bot(log_type, crawler, "公众号_1频控啦,请扫码更换其他公众号token\nhttps://mp.weixin.qq.com/")
-                time.sleep(60 * 10)
-                os.system("ps aux | grep run_gongzhonghao_follow.py | grep -v grep | awk '{print $2}' | xargs kill -9")
-                return
-            else:
-                fakeid = r.json()["list"][int(index) - 1]["fakeid"]
-                head_url = r.json()["list"][int(index) - 1]["round_head_img"]
-                fakeid_dict = {'fakeid': fakeid, 'head_url': head_url}
-                return fakeid_dict
+
+            fakeid = r.json()["list"][int(index) - 1]["fakeid"]
+            head_url = r.json()["list"][int(index) - 1]["round_head_img"]
+            fakeid_dict = {'fakeid': fakeid, 'head_url': head_url}
+            return fakeid_dict
         except Exception as e:
             Common.logger(log_type, crawler).error(f"get_fakeid异常:{e}\n")
 
@@ -247,28 +244,26 @@ class GongzhonghaoFollow:
                         "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_1过期啦,请扫码更换token\nhttps://mp.weixin.qq.com/")
+                        # Feishu.bot(log_type, crawler, "token_1过期啦,请扫码更换token\nhttps://mp.weixin.qq.com/")
                         time.sleep(60 * 10)
                         os.system("ps aux | grep run_gongzhonghao_follow.py | grep -v grep | awk '{print $2}' | xargs kill -9")
                     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,"公众号_1频控啦,请扫码更换其他公众号token\nhttps://mp.weixin.qq.com/")
+                        # Feishu.bot(log_type, crawler,"公众号_1频控啦,请扫码更换其他公众号token\nhttps://mp.weixin.qq.com/")
                         time.sleep(60 * 10)
                         os.system("ps aux | grep run_gongzhonghao_follow.py | grep -v grep | awk '{print $2}' | xargs kill -9")
+                    elif 'app_msg_list' not in r.json() 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, "公众号_1频控啦,请扫码更换其他公众号token\nhttps://mp.weixin.qq.com/")
+                        time.sleep(60 * 10)
+                        os.system(
+                            "ps aux | grep run_gongzhonghao_follow.py | grep -v grep | awk '{print $2}' | xargs kill -9")
                     else:
                         break
-                if 'app_msg_list' not in r.json():
-                    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,
-                               "公众号_1频控啦,请扫码更换其他公众号token\nhttps://mp.weixin.qq.com/")
-                    time.sleep(60 * 10)
-                    os.system(
-                        "ps aux | grep run_gongzhonghao_follow.py | grep -v grep | awk '{print $2}' | xargs kill -9")
-                    return
-                elif len(r.json()['app_msg_list']) == 0:
+                if len(r.json()['app_msg_list']) == 0:
                     Common.logger(log_type, crawler).info('没有更多视频了\n')
                     return
                 else:

+ 21 - 24
gongzhonghao/gongzhonghao_follow/gongzhonghao_follow_2.py

@@ -118,28 +118,27 @@ class GongzhonghaoFollow2:
                 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).warning(f"get_gzh_url:{r.text}\n")
-                    Feishu.bot(log_type, crawler, "token_2过期啦,请扫码更换token\nhttps://mp.weixin.qq.com/")
+                    # Feishu.bot(log_type, crawler, "token_2过期啦,请扫码更换token\nhttps://mp.weixin.qq.com/")
                     time.sleep(60 * 10)
                     os.system("ps aux | grep run_gongzhonghao_follow_2 | grep -v grep | awk '{print $2}' | xargs kill -9")
                 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, "公众号_2频控啦,请扫码更换其他公众号token\nhttps://mp.weixin.qq.com/")
+                    # Feishu.bot(log_type, crawler, "公众号_2频控啦,请扫码更换其他公众号token\nhttps://mp.weixin.qq.com/")
                     time.sleep(60 * 10)
                     os.system("ps aux | grep run_gongzhonghao_follow_2 | grep -v grep | awk '{print $2}' | xargs kill -9")
+                elif "list" not in r.json() or len(r.json()["list"]) == 0 and 21 >= datetime.datetime.now().hour >= 10:
+                    Common.logger(log_type, crawler).info(f"status_code:{r.status_code}")
+                    # Feishu.bot(log_type, crawler, "公众号_2频控啦,请扫码更换其他公众号token\nhttps://mp.weixin.qq.com/")
+                    time.sleep(60 * 10)
+                    os.system(
+                        "ps aux | grep run_gongzhonghao_follow_2 | grep -v grep | awk '{print $2}' | xargs kill -9")
                 else:
                     break
-            if "list" not in r.json() or len(r.json()["list"]) == 0:
-                Common.logger(log_type, crawler).info(f"status_code:{r.status_code}")
-                Feishu.bot(log_type, crawler, "公众号_2频控啦,请扫码更换其他公众号token\nhttps://mp.weixin.qq.com/")
-                time.sleep(60 * 10)
-                os.system("ps aux | grep run_gongzhonghao_follow_2 | grep -v grep | awk '{print $2}' | xargs kill -9")
-                return
-            else:
-                fakeid = r.json()["list"][int(index) - 1]["fakeid"]
-                head_url = r.json()["list"][int(index) - 1]["round_head_img"]
-                fakeid_dict = {'fakeid': fakeid, 'head_url': head_url}
-                return fakeid_dict
+            fakeid = r.json()["list"][int(index) - 1]["fakeid"]
+            head_url = r.json()["list"][int(index) - 1]["round_head_img"]
+            fakeid_dict = {'fakeid': fakeid, 'head_url': head_url}
+            return fakeid_dict
         except Exception as e:
             Common.logger(log_type, crawler).error(f"get_fakeid异常:{e}\n")
 
@@ -243,27 +242,25 @@ class GongzhonghaoFollow2:
                         "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_2过期啦,请扫码更换token\nhttps://mp.weixin.qq.com/")
+                        # Feishu.bot(log_type, crawler, "token_2过期啦,请扫码更换token\nhttps://mp.weixin.qq.com/")
                         time.sleep(60 * 10)
                         os.system("ps aux | grep run_gongzhonghao_follow_2 | grep -v grep | awk '{print $2}' | xargs kill -9")
                     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, "公众号_2频控啦,请扫码更换其他公众号token\nhttps://mp.weixin.qq.com/")
+                        # Feishu.bot(log_type, crawler, "公众号_2频控啦,请扫码更换其他公众号token\nhttps://mp.weixin.qq.com/")
+                        time.sleep(60 * 10)
+                        os.system("ps aux | grep run_gongzhonghaofollow_2 | grep -v grep | awk '{print $2}' | xargs kill -9")
+                    elif 'app_msg_list' not in r.json() 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, "公众号_2频控啦,请扫码更换其他公众号token\nhttps://mp.weixin.qq.com/")
                         time.sleep(60 * 10)
                         os.system("ps aux | grep run_gongzhonghaofollow_2 | grep -v grep | awk '{print $2}' | xargs kill -9")
                     else:
                         break
-                if 'app_msg_list' not in r.json():
-                    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, "公众号_2频控啦,请扫码更换其他公众号token\nhttps://mp.weixin.qq.com/")
-                    time.sleep(60 * 10)
-                    os.system(
-                        "ps aux | grep run_gongzhonghaofollow_2 | grep -v grep | awk '{print $2}' | xargs kill -9")
-                    return
-                elif len(r.json()['app_msg_list']) == 0:
+                if len(r.json()['app_msg_list']) == 0:
                     Common.logger(log_type, crawler).info('没有更多视频了\n')
                     return
                 else: