wangkun 2 年之前
父节点
当前提交
0884757007
共有 3 个文件被更改,包括 29 次插入2 次删除
  1. 3 0
      README.md
  2. 11 1
      main/feishu_lib.py
  3. 15 1
      main/run_bot.py

+ 3 - 0
README.md

@@ -25,6 +25,9 @@ https://git.yishihui.com/Server/crawler_bot.git
 
 
 #### 需求
+2022/11/30
+1. 增加报警: 宗教公众号
+
 2022/11/21
 1. 增加报警: 祝福猫视频
 

+ 11 - 1
main/feishu_lib.py

@@ -44,6 +44,8 @@ class Feishu:
     crawler_ssnnyfq = 'https://w42nne6hzg.feishu.cn/sheets/shtcnyJmJSJynHDLLbLTkySfvZe?'
     # 祝福猫视频
     crawler_zhufumao = 'https://w42nne6hzg.feishu.cn/sheets/shtcnXfIJthvkjhI5zlEJq84i6g?'
+    # 宗教公众号
+    crawler_zongjiao = 'https://w42nne6hzg.feishu.cn/sheets/shtcn73NW0CyoOeF21HWO15KBsb?'
 
     # 飞书路径token
     @classmethod
@@ -83,6 +85,8 @@ class Feishu:
             return 'shtcnyJmJSJynHDLLbLTkySfvZe'
         elif crawler == 'zhufumao':
             return 'shtcnXfIJthvkjhI5zlEJq84i6g'
+        elif crawler == 'zongjiao':
+            return 'shtcn73NW0CyoOeF21HWO15KBsb'
 
     # 获取飞书api token
     @classmethod
@@ -502,6 +506,12 @@ class Feishu:
                 users = "\n<at id=" + str(cls.get_userid(log_type, "wangkun")) + "></at> <at id=" + str(
                     cls.get_userid(log_type, "lijinchao")) + "></at>\n"
 
+            elif crawler == "zongjiao":
+                content = "宗教公众号爬虫表"
+                sheet_url = "https://w42nne6hzg.feishu.cn/sheets/shtcn73NW0CyoOeF21HWO15KBsb"
+                users = "\n<at id=" + str(cls.get_userid(log_type, "wangkun")) + "></at> <at id=" + str(
+                    cls.get_userid(log_type, "lijinchao")) + "></at>\n"
+
             else:
                 content = "小年糕爬虫表"
                 sheet_url = "https://w42nne6hzg.feishu.cn/sheets/shtcnYxiyQ1wLklo1W5Kdqc9cGh"
@@ -549,7 +559,7 @@ class Feishu:
 
 
 if __name__ == "__main__":
-    Feishu.bot("bot", "zhufumao", "别紧张,还是我,测试一下")
+    Feishu.bot("bot", "zongjiao", "别紧张,还是我,测试一下")
     # print(Feishu.get_userid("shipinhao", "lijinchao"))
     
     pass

+ 15 - 1
main/run_bot.py

@@ -132,6 +132,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 == "zongjiao":
+                sheet = Feishu.get_values_batch(log_type, "zongjiao", "xf9wC2")
+                # 已下载表,最新一条视频抓取时间
+                first_download_time = sheet[1][5]
+                first_download_time = int(time.mktime(time.strptime(first_download_time, "%Y/%m/%d %H:%M:%S")))
+
             else:
                 sheet = Feishu.get_values_batch(log_type, "xiaoniangao", "yatRv2")
                 # 已下载表,最新一条视频抓取时间
@@ -253,6 +259,11 @@ class Bot:
                 Feishu.bot(log_type, crawler, "视频号已下载表,超过24小时没有新视频入库了😤")
                 Common.logger(log_type).warning("视频号已下载表,超过24小时没有新视频入库了😤\n")
 
+            # 宗教公众号爬虫报警
+            elif crawler == "zongjiao" 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")
+
         except Exception as e:
             Common.logger(log_type).error(f"robot_alarm异常:{e}\n")
 
@@ -309,6 +320,9 @@ class Bot:
                 Common.logger("bot").info("监控视频号已下载表")
                 Bot.robot_download_sheet("bot", "shipinhao", duration)
 
+                Common.logger("bot").info("监控宗教公众号已下载表")
+                Bot.robot_download_sheet("bot", "zongjiao", duration)
+
                 # Common.logger("bot").info("监控公众号已下载表")
                 # Bot.robot_download_sheet("bot", "gzh", duration)
 
@@ -327,7 +341,7 @@ class Bot:
 
 if __name__ == "__main__":
 
-    # Bot.robot_download_sheet("bot", "zhufumao", 1)
+    # Bot.robot_download_sheet("bot", "zongjiao", 1)
     Bot.main()
 
     pass