run_follow.py 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. # -*- coding: utf-8 -*-
  2. # @Author: wangkun
  3. # @Time: 2022/7/11
  4. import datetime
  5. import os
  6. import random
  7. import sys
  8. import time
  9. sys.path.append(os.getcwd())
  10. from main.common import Common
  11. from main.follow_list import Follow
  12. class Main:
  13. @classmethod
  14. def main(cls, env):
  15. while True:
  16. if datetime.datetime.now().hour >= 1:
  17. # Common.logger("follow").info("同步关注人列表\n")
  18. # Follow.del_follow_user_from_feishu('follow')
  19. # Follow.get_follow_users_to_feishu('follow')
  20. Common.logger("follow").info("获取关注人列表\n")
  21. Follow.get_follow_users('follow')
  22. Common.logger("follow").info("开始抓取个人主页视频\n")
  23. Follow.get_videos_from_follow("follow", env)
  24. # 清除日志
  25. Common.del_logs("follow")
  26. Common.logger("follow").info("休眠{}小时\n", 24-datetime.datetime.now().hour)
  27. Follow.follow_pcursor = ""
  28. Follow.person_pcursor = ""
  29. Follow.send_time = 0
  30. time.sleep(60*(24-datetime.datetime.now().hour))
  31. else:
  32. pass
  33. if __name__ == "__main__":
  34. Main.main('prod')