# -*- coding: utf-8 -*- # @Author: wangkun # @Time: 2022/8/31 import datetime import os import sys import time sys.path.append(os.getcwd()) from main.common import Common from main.shipinhao_recommend import Recommend class Main: @classmethod def main(cls, env): while True: if 20 >= datetime.datetime.now().hour >= 10: if len(Recommend.download_cnt) >= 100: Recommend.download_cnt = [] Common.del_logs('recommend') Common.logger('recommend').info( '已下载{}条视频,休眠{}小时', len(Recommend.download_cnt), 24-datetime.datetime.now().hour) time.sleep(3600 * (24-datetime.datetime.now().hour)) else: Recommend.start_wechat('recommend', env) time.sleep(3) else: pass if __name__ == '__main__': Main.main('prod')