run_follow.py 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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.get_follow_users('follow')
  19. Common.logger("follow").info("开始抓取个人主页视频\n")
  20. Follow.get_videos_from_follow("follow", env)
  21. # 清除日志
  22. Common.del_logs("follow")
  23. Common.logger("follow").info("休眠{}小时\n", 24-datetime.datetime.now().hour)
  24. Follow.follow_pcursor = ""
  25. Follow.person_pcursor = ""
  26. Follow.send_time = 0
  27. time.sleep(60*(24-datetime.datetime.now().hour))
  28. else:
  29. pass
  30. if __name__ == "__main__":
  31. Main.main('prod')