wangkun před 2 roky
rodič
revize
2f2aa79ff5
3 změnil soubory, kde provedl 31 přidání a 3 odebrání
  1. 4 1
      README.md
  2. 11 1
      main/feishu_lib.py
  3. 16 1
      main/run_bot.py

+ 4 - 1
README.md

@@ -1,7 +1,6 @@
 # 爬虫监控
 https://git.yishihui.com/Server/crawler_bot.git
 
-
 #### 增加监控渠道
 1. feishu_lib:
    1. 增加爬虫表链接
@@ -26,6 +25,10 @@ https://git.yishihui.com/Server/crawler_bot.git
 
 
 #### 需求
+2022/11/09
+1. 增加报警: 岁岁年年迎福气小程序
+
+2022/11/07
 1. 增加: 吉祥幸福小程序报警
 2. 增加: 众妙音信小程序报警
 

+ 11 - 1
main/feishu_lib.py

@@ -40,6 +40,8 @@ class Feishu:
     crawler_jixiangxingfu = 'https://w42nne6hzg.feishu.cn/sheets/shtcnSx4nafMbLTq7xl7RHBwHBf?'
     # 众妙音信
     crawler_zmyx = 'https://w42nne6hzg.feishu.cn/sheets/shtcnbZIxstPeM0xshW07b26sve?'
+    # 岁岁年年迎福气
+    crawler_ssnnyfq = 'https://w42nne6hzg.feishu.cn/sheets/shtcnyJmJSJynHDLLbLTkySfvZe?'
 
     # 飞书路径token
     @classmethod
@@ -75,6 +77,8 @@ class Feishu:
             return 'shtcnSx4nafMbLTq7xl7RHBwHBf'
         elif crawler == 'zmyx':
             return 'shtcnbZIxstPeM0xshW07b26sve'
+        elif crawler == 'ssnnyfq':
+            return 'shtcnyJmJSJynHDLLbLTkySfvZe'
 
     # 获取飞书api token
     @classmethod
@@ -454,6 +458,12 @@ class Feishu:
                 users = "\n<at id=" + str(cls.get_userid(log_type, "wangkun")) + "></at> <at id=" + str(
                     cls.get_userid(log_type, "xinxin")) + "></at>\n"
 
+            elif crawler == "ssnnyfq":
+                content = "岁岁年年迎福气_已下载表"
+                sheet_url = "https://w42nne6hzg.feishu.cn/sheets/shtcnyJmJSJynHDLLbLTkySfvZe?sheet=290bae"
+                users = "\n<at id=" + str(cls.get_userid(log_type, "wangkun")) + "></at> <at id=" + str(
+                    cls.get_userid(log_type, "xinxin")) + "></at>\n"
+
             elif crawler == "gzh":
                 content = "公众号爬虫表"
                 sheet_url = "https://w42nne6hzg.feishu.cn/sheets/shtcnexNXnpDLHhARw0QdiwbYuA"
@@ -525,7 +535,7 @@ class Feishu:
 
 
 if __name__ == "__main__":
-    Feishu.bot("bot", "zmyx", "别紧张,测试一下。")
+    Feishu.bot("bot", "ssnnyfq", "别紧张,测试一下。")
     # Feishu.get_userid("kuaishou", "huxinxue")
     
     pass

+ 16 - 1
main/run_bot.py

@@ -138,6 +138,12 @@ class Bot:
                 first_download_time = sheet[1][5]
                 first_download_time = int(time.mktime(time.strptime(first_download_time, "%Y/%m/%d %H:%M:%S")))
 
+            elif crawler == 'ssnnyfq':
+                sheet = Feishu.get_values_batch(log_type, "ssnnyfq", "290bae")
+                # 已下载表,最新一条视频抓取时间
+                first_download_time = sheet[1][5]
+                first_download_time = int(time.mktime(time.strptime(first_download_time, "%Y/%m/%d %H:%M:%S")))
+
             elif crawler == "kanyikan":
                 sheet = Feishu.get_values_batch(log_type, "kanyikan", "20ce0c")
                 # 已下载表,最新一条视频抓取时间
@@ -259,6 +265,12 @@ class Bot:
                 Feishu.bot(log_type, crawler, "众妙音信_已下载表,超过24小时没有新视频入库了😤")
                 Common.logger(log_type).warning("众妙音信_已下载表,超过24小时没有新视频入库了😤\n")
 
+            # 岁岁年年迎福气
+            elif crawler == "ssnnyfq" and (
+                    int(time.time()) - cls.get_first_time(log_type, crawler) > int(duration)):
+                Feishu.bot(log_type, crawler, "岁岁年年迎福气_已下载表,超过24小时没有新视频入库了😤")
+                Common.logger(log_type).warning("岁岁年年迎福气_已下载表,超过24小时没有新视频入库了😤\n")
+
             # 音乐相册爬虫报警
             elif crawler == "music_album" and (
                     int(time.time()) - cls.get_first_time(log_type, crawler) > int(duration)):
@@ -335,6 +347,9 @@ class Bot:
                 Common.logger("bot").info("监控众妙音信已下载表")
                 Bot.robot_download_sheet("bot", "zmyx", duration)
 
+                Common.logger("bot").info("监控岁岁年年迎福气已下载表")
+                Bot.robot_download_sheet("bot", "ssnnyfq", duration)
+
                 Common.logger("bot").info("监控本山祝福已下载表")
                 Bot.robot_download_sheet("bot", "bszf", duration)
 
@@ -366,7 +381,7 @@ class Bot:
 
 if __name__ == "__main__":
     # Bot.robot_download_sheet("bot", "kuaishou_recommend", 1)
-    # Bot.robot_download_sheet("bot", "zmyx", 1)
+    # Bot.robot_download_sheet("bot", "ssnnyfq", 1)
     Bot.main()
 
     pass