瀏覽代碼

add weiqun_video

wangkun 2 年之前
父節點
當前提交
6cdabbab81
共有 3 個文件被更改,包括 48 次插入10 次删除
  1. 7 2
      main/demo.py
  2. 14 7
      main/feishu_lib.py
  3. 27 1
      main/run_bot.py

+ 7 - 2
main/demo.py

@@ -1,12 +1,17 @@
 # -*- coding: utf-8 -*-
 # @Author: wangkun
 # @Time: 2022/8/10
+from main.feishu_lib import Feishu
+
 
 class Demo:
     @classmethod
     def demo1(cls):
-        for i in range(3):
-            print(i)
+        sheet = Feishu.get_values_batch("bot", "weiqun", "3cd128")
+        # print(sheet[1])
+        # 已下载表,最新一条视频抓取时间
+        first_download_time = sheet[1][5]
+        print(first_download_time)
 
 
 if __name__ == "__main__":

+ 14 - 7
main/feishu_lib.py

@@ -32,6 +32,8 @@ class Feishu:
     gzh_url = "https://w42nne6hzg.feishu.cn/sheets/shtcnexNXnpDLHhARw0QdiwbYuA?"
     # 数据监控表
     crawler_monitor = "https://w42nne6hzg.feishu.cn/sheets/shtcnlZWYazInhf7Z60jkbLRJyd?"
+    # 微群视频爬虫表
+    crawler_weiqun_video = "https://w42nne6hzg.feishu.cn/sheets/shtcnoKThNquYRweaylMFVyo9Hc?"
 
     # 手机号
     wangkun = "13426262515"
@@ -62,6 +64,8 @@ class Feishu:
             return "shtcnGh2rrsPYM4iVNEBO7OqWrb"
         elif crawler == "gzh":
             return "shtcnexNXnpDLHhARw0QdiwbYuA"
+        elif crawler == "weiqun":
+            return "shtcnoKThNquYRweaylMFVyo9Hc"
 
     # 获取飞书api token
     @classmethod
@@ -355,25 +359,28 @@ class Feishu:
             }
             if crawler == "kanyikan":
                 content = "看一看爬虫表"
-                sheet_url = "https://w42nne6hzg.feishu.cn/sheets/shtcngRPoDYAi24x52j2nDuHMih?sheet=20ce0c"
+                sheet_url = "https://w42nne6hzg.feishu.cn/sheets/shtcngRPoDYAi24x52j2nDuHMih"
             elif crawler == "xiaoniangao":
                 content = "小年糕爬虫表"
-                sheet_url = "https://w42nne6hzg.feishu.cn/sheets/shtcnYxiyQ1wLklo1W5Kdqc9cGh?sheet=yatRv2"
+                sheet_url = "https://w42nne6hzg.feishu.cn/sheets/shtcnYxiyQ1wLklo1W5Kdqc9cGh"
             elif crawler == "music_album":
                 content = "音乐相册爬虫表"
-                sheet_url = "https://w42nne6hzg.feishu.cn/sheets/shtcnT6zvmfsYe1g0iv4pt7855g?sheet=f5a76e"
+                sheet_url = "https://w42nne6hzg.feishu.cn/sheets/shtcnT6zvmfsYe1g0iv4pt7855g"
             elif crawler == "bszf":
                 content = "本山祝福爬虫表"
-                sheet_url = "https://w42nne6hzg.feishu.cn/sheets/shtcnGh2rrsPYM4iVNEBO7OqWrb?sheet=440018"
+                sheet_url = "https://w42nne6hzg.feishu.cn/sheets/shtcnGh2rrsPYM4iVNEBO7OqWrb"
             elif crawler == "kuaishou":
                 content = "快手爬虫表"
-                sheet_url = "https://w42nne6hzg.feishu.cn/sheets/shtcnICEfaw9llDNQkKgdymM1xf?sheet=3cd128"
+                sheet_url = "https://w42nne6hzg.feishu.cn/sheets/shtcnICEfaw9llDNQkKgdymM1xf"
             elif crawler == "gzh":
                 content = "公众号爬虫表"
-                sheet_url = "https://w42nne6hzg.feishu.cn/sheets/shtcnexNXnpDLHhARw0QdiwbYuA?sheet=fCs3BT"
+                sheet_url = "https://w42nne6hzg.feishu.cn/sheets/shtcnexNXnpDLHhARw0QdiwbYuA"
+            elif crawler == "weiqun":
+                content = "微群爬虫表"
+                sheet_url = "https://w42nne6hzg.feishu.cn/sheets/shtcnoKThNquYRweaylMFVyo9Hc"
             else:
                 content = "小年糕爬虫表"
-                sheet_url = "https://w42nne6hzg.feishu.cn/sheets/shtcnYxiyQ1wLklo1W5Kdqc9cGh?sheet=yatRv2"
+                sheet_url = "https://w42nne6hzg.feishu.cn/sheets/shtcnYxiyQ1wLklo1W5Kdqc9cGh"
 
             data = json.dumps({
                 "msg_type": "interactive",

+ 27 - 1
main/run_bot.py

@@ -53,6 +53,12 @@ class Bot:
                 # 已下载表,最新一条视频抓取时间
                 first_download_time = sheet[1][3]
                 first_download_time = int(time.mktime(time.strptime(first_download_time, "%Y/%m/%d %H:%M:%S")))
+            elif crawler == "weiqun":
+                sheet = Feishu.get_values_batch(log_type, "weiqun", "3cd128")
+                # print(sheet[1])
+                # 已下载表,最新一条视频抓取时间
+                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")
                 # 已下载表,最新一条视频抓取时间
@@ -140,26 +146,42 @@ class Bot:
         已下载视频表:超过24小时没有新入库的视频
         """
         try:
+            # 看一看爬虫报警
             if crawler == "kanyikan" and (int(time.time()) - cls.get_first_time(log_type, crawler) > int(duration)):
                 Feishu.bot(log_type, crawler, "看一看已下载表,超过24小时没有新视频入库了😤")
                 Common.logger(log_type).info("看一看已下载表,超过24小时没有新视频入库了😤\n")
+
+            # 小年糕爬虫报警
             elif crawler == "xiaoniangao" and (
                     int(time.time()) - cls.get_first_time(log_type, crawler) > int(duration)):
                 Feishu.bot(log_type, crawler, "小年糕已下载表,超过24小时没有新视频入库了😤")
                 Common.logger(log_type).info("小年糕已下载表,超过24小时没有新视频入库了😤\n")
+
+            # 音乐相册爬虫报警
             elif crawler == "music_album" and (
                     int(time.time()) - cls.get_first_time(log_type, crawler) > int(duration)):
                 Feishu.bot(log_type, crawler, "音乐相册已下载表,超过24小时没有新视频入库了😤")
                 Common.logger(log_type).info("音乐相册已下载表,超过24小时没有新视频入库了😤\n")
+
+            # 本山祝福爬虫报警
             elif crawler == "bszf" and (int(time.time()) - cls.get_first_time(log_type, crawler) > int(duration)):
                 Feishu.bot(log_type, crawler, "本山祝福已下载表,超过24小时没有新视频入库了😤")
                 Common.logger(log_type).info("本山祝福已下载表,超过24小时没有新视频入库了😤\n")
+
+            # 快手爬虫报警
             elif crawler == "kuaishou" and (int(time.time()) - cls.get_first_time(log_type, crawler) > int(duration)):
                 Feishu.bot(log_type, crawler, "快手已下载表,超过24小时没有新视频入库了😤")
                 Common.logger(log_type).info("快手已下载表,超过24小时没有新视频入库了😤\n")
+
+            # 公众号爬虫报警
             elif crawler == "gzh" and (int(time.time()) - cls.get_first_time(log_type, crawler) > int(duration)):
-                Feishu.bot(log_type, crawler, "公众号已下载表,超过24小时没有新视频入库了😤]️")
+                Feishu.bot(log_type, crawler, "公众号已下载表,超过24小时没有新视频入库了😤")
                 Common.logger(log_type).info("公众号已下载表,超过24小时没有新视频入库了😤\n")
+
+            # 微群视频爬虫报警
+            elif crawler == "weiqun" and (int(time.time()) - cls.get_first_time(log_type, crawler) > int(duration)):
+                Feishu.bot(log_type, crawler, "微群视频已下载表,超过24小时没有新视频入库了😤")
+                Common.logger(log_type).info("微群视频已下载表,超过24小时没有新视频入库了😤\n")
         except Exception as e:
             Common.logger(log_type).error("robot_alarm异常:{}", e)
 
@@ -190,6 +212,9 @@ class Bot:
                 Common.logger("bot").info("监控快手已下载表")
                 Bot.robot_download_sheet("bot", "kuaishou", duration)
 
+                Common.logger("bot").info("监控微群视频已下载表")
+                Bot.robot_download_sheet("bot", "weiqun", duration)
+
                 # Common.logger("bot").info("监控公众号已下载表")
                 # Bot.robot_alarm("bot", "gzh", duration)
 
@@ -203,4 +228,5 @@ class Bot:
 if __name__ == "__main__":
     # Bot.get_feeds_sheet("bot", "gzh", "recommend")
     # Bot.rebot_feeds_sheet("bot", "gzh", "recommend")
+    # Bot.robot_download_sheet("bot", "weiqun", 10)
     Bot.main()