wangkun 2 년 전
부모
커밋
44faa0c681
4개의 변경된 파일45개의 추가작업 그리고 2개의 파일을 삭제
  1. 3 0
      README.md
  2. 16 1
      main/feishu_lib.py
  3. 26 1
      main/run_bot.py
  4. 0 0
      nohup.out

+ 3 - 0
README.md

@@ -25,6 +25,9 @@ https://git.yishihui.com/Server/crawler_bot.git
 
 
 #### 需求
+2022/12/06
+1. 增加报警:好看视频 PC 版
+
 2022/11/30
 1. 增加报警: 宗教公众号
 

+ 16 - 1
main/feishu_lib.py

@@ -46,6 +46,8 @@ class Feishu:
     crawler_zhufumao = 'https://w42nne6hzg.feishu.cn/sheets/shtcnXfIJthvkjhI5zlEJq84i6g?'
     # 宗教公众号
     crawler_zongjiao = 'https://w42nne6hzg.feishu.cn/sheets/shtcn73NW0CyoOeF21HWO15KBsb?'
+    # 好看视频
+    crawler_haokan = 'https://w42nne6hzg.feishu.cn/sheets/shtcnaYz8Nhv8q6DbWtlL6rMEBd'
 
     # 飞书路径token
     @classmethod
@@ -87,6 +89,8 @@ class Feishu:
             return 'shtcnXfIJthvkjhI5zlEJq84i6g'
         elif crawler == 'zongjiao':
             return 'shtcn73NW0CyoOeF21HWO15KBsb'
+        elif crawler == 'haokan':
+            return 'shtcnaYz8Nhv8q6DbWtlL6rMEBd'
 
     # 获取飞书api token
     @classmethod
@@ -435,6 +439,17 @@ class Feishu:
                 users = "\n<at id=" + str(cls.get_userid(log_type, "wangkun")) + "></at> <at id=" + str(
                     cls.get_userid(log_type, "huxinxue")) + "></at>\n"
 
+            elif crawler == 'haokan_hot':
+                content = '好看_热榜_已下载表'
+                sheet_url = 'https://w42nne6hzg.feishu.cn/sheets/shtcnaYz8Nhv8q6DbWtlL6rMEBd?sheet=5pWipX'
+                users = "\n<at id=" + str(cls.get_userid(log_type, "wangkun")) + "></at> <at id=" + str(
+                    cls.get_userid(log_type, "huxinxue")) + "></at>\n"
+            elif crawler == 'haokan_channel':
+                content = '好看_频道_已下载表'
+                sheet_url = 'https://w42nne6hzg.feishu.cn/sheets/shtcnaYz8Nhv8q6DbWtlL6rMEBd?sheet=7f05d8'
+                users = "\n<at id=" + str(cls.get_userid(log_type, "wangkun")) + "></at> <at id=" + str(
+                    cls.get_userid(log_type, "huxinxue")) + "></at>\n"
+
             elif crawler == "music_album":
                 content = "音乐相册爬虫表"
                 sheet_url = "https://w42nne6hzg.feishu.cn/sheets/shtcnT6zvmfsYe1g0iv4pt7855g"
@@ -559,7 +574,7 @@ class Feishu:
 
 
 if __name__ == "__main__":
-    Feishu.bot("bot", "zongjiao", "别紧张,还是我,测试一下")
+    Feishu.bot("bot", "haokan_channel", "别紧张,还是我,测试一下")
     # print(Feishu.get_userid("shipinhao", "lijinchao"))
     
     pass

+ 26 - 1
main/run_bot.py

@@ -55,6 +55,17 @@ 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 == 'haokan_hot':
+                sheet = Feishu.get_values_batch(log_type, "haokan", "5pWipX")
+                # 已下载表,最新一条视频抓取时间
+                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 == 'haokan_channel':
+                sheet = Feishu.get_values_batch(log_type, "haokan", "7f05d8")
+                # 已下载表,最新一条视频抓取时间
+                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")
                 # 已下载表,最新一条视频抓取时间
@@ -194,6 +205,16 @@ class Bot:
                 Feishu.bot(log_type, crawler, "知乎_定向_已下载表,超过24小时没有新视频入库了😤")
                 Common.logger(log_type).warning("知乎_定向_已下载表,超过24小时没有新视频入库了😤\n")
 
+            # 好看视频
+            elif crawler == "haokan_hot" 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 == "haokan_channel" 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 == "jxxf" and (
                     int(time.time()) - cls.get_first_time(log_type, crawler) > int(duration)):
@@ -295,6 +316,10 @@ 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", "haokan_hot", duration)
+                Bot.robot_download_sheet("bot", "haokan_channel", duration)
+
                 Common.logger("bot").info("监控吉祥幸福已下载表")
                 Bot.robot_download_sheet("bot", "jxxf", duration)
 
@@ -341,7 +366,7 @@ class Bot:
 
 if __name__ == "__main__":
 
-    # Bot.robot_download_sheet("bot", "zongjiao", 1)
+    # Bot.robot_download_sheet("bot", "haokan_channel", 1)
     Bot.main()
 
     pass

+ 0 - 0
nohup.out