wangkun 2 лет назад
Родитель
Сommit
19f67bac73
3 измененных файлов с 55 добавлено и 2 удалено
  1. 3 0
      README.md
  2. 21 1
      main/feishu_lib.py
  3. 31 1
      main/run_bot.py

+ 3 - 0
README.md

@@ -26,6 +26,9 @@ https://git.yishihui.com/Server/crawler_bot.git
 
 
 #### 需求
+1. 增加: 吉祥幸福小程序报警
+2. 增加: 众妙音信小程序报警
+
 2022/11/03
 1. 增加:知乎 PC 端爬虫报警
 

+ 21 - 1
main/feishu_lib.py

@@ -36,6 +36,10 @@ class Feishu:
     crawler_xigua = 'https://w42nne6hzg.feishu.cn/sheets/shtcnvOpx2P8vBXiV91Ot1MKIw8?'
     # 知乎 PC 端
     crawler_zhihu = 'https://w42nne6hzg.feishu.cn/sheets/shtcnkGPBmGsjaqapgzouuj8MXe?'
+    # 吉祥幸福
+    crawler_jixiangxingfu = 'https://w42nne6hzg.feishu.cn/sheets/shtcnSx4nafMbLTq7xl7RHBwHBf?'
+    # 众妙音信
+    crawler_zmyx = 'https://w42nne6hzg.feishu.cn/sheets/shtcnbZIxstPeM0xshW07b26sve?'
 
     # 飞书路径token
     @classmethod
@@ -67,6 +71,10 @@ class Feishu:
             return 'shtcnvOpx2P8vBXiV91Ot1MKIw8'
         elif crawler == 'zhihu':
             return 'shtcnkGPBmGsjaqapgzouuj8MXe'
+        elif crawler == 'jxxf':
+            return 'shtcnSx4nafMbLTq7xl7RHBwHBf'
+        elif crawler == 'zmyx':
+            return 'shtcnbZIxstPeM0xshW07b26sve'
 
     # 获取飞书api token
     @classmethod
@@ -423,6 +431,18 @@ class Feishu:
                 users = "\n<at id=" + str(cls.get_userid(log_type, "wangkun")) + "></at> <at id=" + str(
                     cls.get_userid(log_type, "gaonannan")) + "></at>\n"
 
+            elif crawler == "jxxf":
+                content = "吉祥幸福爬虫表"
+                sheet_url = "https://w42nne6hzg.feishu.cn/sheets/shtcnSx4nafMbLTq7xl7RHBwHBf"
+                users = "\n<at id=" + str(cls.get_userid(log_type, "wangkun")) + "></at> <at id=" + str(
+                    cls.get_userid(log_type, "gaonannan")) + "></at>\n"
+
+            elif crawler == "zmyx":
+                content = "众妙音信爬虫表"
+                sheet_url = "https://w42nne6hzg.feishu.cn/sheets/shtcnbZIxstPeM0xshW07b26sve"
+                users = "\n<at id=" + str(cls.get_userid(log_type, "wangkun")) + "></at> <at id=" + str(
+                    cls.get_userid(log_type, "gaonannan")) + "></at>\n"
+
             elif crawler == "kuaishou_follow":
                 content = "快手_用户主页_已下载表"
                 sheet_url = "https://w42nne6hzg.feishu.cn/sheets/shtcnICEfaw9llDNQkKgdymM1xf?sheet=fYdA8F"
@@ -505,7 +525,7 @@ class Feishu:
 
 
 if __name__ == "__main__":
-    Feishu.bot("bot", "zhihu_hot", "嘿。嘿嘿。。嘿嘿嘿")
+    Feishu.bot("bot", "zmyx", "别紧张,测试一下。")
     # Feishu.get_userid("kuaishou", "huxinxue")
     
     pass

+ 31 - 1
main/run_bot.py

@@ -126,6 +126,18 @@ 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 == 'jxxf':
+                sheet = Feishu.get_values_batch(log_type, "jxxf", "d9e9b1")
+                # 已下载表,最新一条视频抓取时间
+                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 == 'zmyx':
+                sheet = Feishu.get_values_batch(log_type, "zmyx", "19c772")
+                # 已下载表,最新一条视频抓取时间
+                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")
                 # 已下载表,最新一条视频抓取时间
@@ -235,6 +247,18 @@ class Bot:
                 Feishu.bot(log_type, crawler, "知乎_定向_已下载表,超过24小时没有新视频入库了😤")
                 Common.logger(log_type).warning("知乎_定向_已下载表,超过24小时没有新视频入库了😤\n")
 
+            # 吉祥幸福
+            elif crawler == "jxxf" 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 == "zmyx" 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)):
@@ -305,6 +329,12 @@ class Bot:
                 Bot.robot_download_sheet("bot", "zhihu_hot", duration)
                 Bot.robot_download_sheet("bot", "zhihu_follow", duration)
 
+                Common.logger("bot").info("监控吉祥幸福已下载表")
+                Bot.robot_download_sheet("bot", "jxxf", duration)
+
+                Common.logger("bot").info("监控众妙音信已下载表")
+                Bot.robot_download_sheet("bot", "zmyx", duration)
+
                 Common.logger("bot").info("监控本山祝福已下载表")
                 Bot.robot_download_sheet("bot", "bszf", duration)
 
@@ -336,7 +366,7 @@ class Bot:
 
 if __name__ == "__main__":
     # Bot.robot_download_sheet("bot", "kuaishou_recommend", 1)
-    # Bot.robot_download_sheet("bot", "zhihu_follow", 1)
+    # Bot.robot_download_sheet("bot", "zmyx", 1)
     Bot.main()
 
     pass