wangkun 2 rokov pred
rodič
commit
2b8696cb42
3 zmenil súbory, kde vykonal 25 pridanie a 11 odobranie
  1. 1 1
      README.md
  2. 9 4
      main/feishu_lib.py
  3. 15 6
      main/run_bot.py

+ 1 - 1
README.md

@@ -21,7 +21,7 @@ https://git.yishihui.com/Server/crawler_bot.git
 
 #### 使用说明
 1. cd ./crawler_bot 
-2. python3 ./main/run_bot.py 
+2. sh bot.sh
 
 
 #### 需求

+ 9 - 4
main/feishu_lib.py

@@ -515,9 +515,14 @@ 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 == "shipinhao":
-                content = "视频号爬虫表"
-                sheet_url = "https://w42nne6hzg.feishu.cn/sheets/shtcn9rOdZRAGFbRkWpn7hqEHGc"
+            elif crawler == "shipinhao_recommend":
+                content = "视频号_推荐_已下载表"
+                sheet_url = "https://w42nne6hzg.feishu.cn/sheets/shtcn9rOdZRAGFbRkWpn7hqEHGc?sheet=c77cf9"
+                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 == "shipinhao_follow":
+                content = "视频号_定向_已下载表"
+                sheet_url = "https://w42nne6hzg.feishu.cn/sheets/shtcn9rOdZRAGFbRkWpn7hqEHGc?sheet=KsVtLe"
                 users = "\n<at id=" + str(cls.get_userid(log_type, "wangkun")) + "></at> <at id=" + str(
                     cls.get_userid(log_type, "lijinchao")) + "></at>\n"
 
@@ -574,7 +579,7 @@ class Feishu:
 
 
 if __name__ == "__main__":
-    Feishu.bot("bot", "haokan_channel", "别紧张,还是我,测试一下")
+    Feishu.bot("bot", "shipinhao_follow", "别紧张,还是我,测试一下")
     # print(Feishu.get_userid("shipinhao", "lijinchao"))
     
     pass

+ 15 - 6
main/run_bot.py

@@ -137,11 +137,16 @@ 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 == "shipinhao":
+            elif crawler == "shipinhao_recommend":
                 sheet = Feishu.get_values_batch(log_type, "shipinhao", "c77cf9")
                 # 已下载表,最新一条视频抓取时间
                 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 == "shipinhao_follow":
+                sheet = Feishu.get_values_batch(log_type, "shipinhao", "KsVtLe")
+                # 已下载表,最新一条视频抓取时间
+                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")
@@ -276,9 +281,12 @@ class Bot:
                 Common.logger(log_type).warning("微视已下载表,超过24小时没有新视频入库了😤\n")
 
             # 视频号爬虫报警
-            elif crawler == "shipinhao" 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 == "shipinhao_recommend" 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 == "shipinhao_follow" 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 == "zongjiao" and (int(time.time()) - cls.get_first_time(log_type, crawler) > int(duration)):
@@ -343,7 +351,8 @@ class Bot:
                 Bot.robot_download_sheet("bot", "weishi", duration)
 
                 Common.logger("bot").info("监控视频号已下载表")
-                Bot.robot_download_sheet("bot", "shipinhao", duration)
+                # Bot.robot_download_sheet("bot", "shipinhao_recommend", duration)
+                Bot.robot_download_sheet("bot", "shipinhao_follow", duration)
 
                 Common.logger("bot").info("监控宗教公众号已下载表")
                 Bot.robot_download_sheet("bot", "zongjiao", duration)
@@ -366,7 +375,7 @@ class Bot:
 
 if __name__ == "__main__":
 
-    # Bot.robot_download_sheet("bot", "haokan_channel", 1)
+    # Bot.robot_download_sheet("bot", "shipinhao_follow", 1)
     Bot.main()
 
     pass