|
@@ -13,28 +13,26 @@ from common.feishu import Feishu
|
|
|
class WeixinzhishuBot:
|
|
|
@classmethod
|
|
|
def search_key_bot(cls, log_type, crawler):
|
|
|
- if (datetime.datetime.now().hour == 11 and datetime.datetime.now().minute >= 30)\
|
|
|
- or (datetime.datetime.now().hour == 13 and datetime.datetime.now().minute >= 30):
|
|
|
- Common.logger(log_type, crawler).info("开始检测微信指数 Search_Key 抓取状态")
|
|
|
- while True:
|
|
|
- sheet = Feishu.get_values_batch(log_type, crawler, sheetid="sVL74k")
|
|
|
- if sheet is None:
|
|
|
- continue
|
|
|
- first_key_time_str = sheet[1][0]
|
|
|
- if first_key_time_str is None:
|
|
|
- Feishu.bot(log_type, crawler, "微信指数 Search_Key is None ~")
|
|
|
- time.sleep(60*10)
|
|
|
- continue
|
|
|
-
|
|
|
- first_key_time_stamp = int(time.mktime(time.strptime(first_key_time_str, "%Y-%m-%d %H:%M:%S")))
|
|
|
- if int(time.time()) - first_key_time_stamp < 60*3:
|
|
|
- Common.logger(log_type, crawler).info("微信指数 Search_Key 正常")
|
|
|
- time.sleep(60*10)
|
|
|
- else:
|
|
|
- Feishu.bot(log_type, crawler, "微信指数 Search_Key 过期啦 ~")
|
|
|
- return
|
|
|
+ Common.logger(log_type, crawler).info("开始检测微信指数 Search_Key 抓取状态")
|
|
|
+
|
|
|
+ sheet = Feishu.get_values_batch(log_type, crawler, sheetid="sVL74k")
|
|
|
+ if sheet is None:
|
|
|
+ Common.logger(log_type, crawler).info(f"Search_Key_sheet:{sheet}\n")
|
|
|
+
|
|
|
+ first_key_time_str = sheet[1][0]
|
|
|
+ if first_key_time_str is None:
|
|
|
+ if 14 >= datetime.datetime.now().hour >= 11 and datetime.datetime.now().minute >= 40:
|
|
|
+ Feishu.bot(log_type, crawler, "微信指数 Search_Key is None ~")
|
|
|
+ time.sleep(3600*2)
|
|
|
+
|
|
|
+ first_key_time_stamp = int(time.mktime(time.strptime(first_key_time_str, "%Y-%m-%d %H:%M:%S")))
|
|
|
+ if int(time.time()) - first_key_time_stamp >= 60*3:
|
|
|
+ if 14 >= datetime.datetime.now().hour >= 11 and datetime.datetime.now().minute >= 40:
|
|
|
+ Feishu.bot(log_type, crawler, "微信指数 Search_Key 过期啦 ~")
|
|
|
+ time.sleep(3600*2)
|
|
|
else:
|
|
|
- Common.logger(log_type, crawler).info("微信指数 Search_Key 抓取状态检测结束\n")
|
|
|
+ Common.logger(log_type, crawler).info("微信指数 Search_Key 正常")
|
|
|
+ Common.logger(log_type, crawler).info("微信指数 Search_Key 抓取状态检测结束\n")
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|