account_explore_task.py 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. """
  2. @author: luojunhui
  3. @description: try to get some more accounts
  4. """
  5. from tasks.crawler_accounts_by_association import ChannelsAccountCrawler
  6. from tasks.crawler_accounts_by_association import ToutiaoAccountCrawler
  7. from tasks.crawler_accounts_by_association import HaoKanAccountCrawler
  8. from tasks.crawler_accounts_by_association import GzhAccountCrawler
  9. from tasks.generate_search_keys import get_association_title_list_in_multi_threads
  10. def deal_each_platform(platform: str) -> None:
  11. """
  12. deal each platform
  13. :param platform: str, channels or toutiao
  14. """
  15. match platform:
  16. case "toutiao":
  17. crawler = ToutiaoAccountCrawler()
  18. case "sph":
  19. crawler = ChannelsAccountCrawler()
  20. case "hksp":
  21. crawler = HaoKanAccountCrawler()
  22. case "gzh":
  23. crawler = GzhAccountCrawler()
  24. case _:
  25. raise RuntimeError("platform error")
  26. # start process
  27. crawler.deal()
  28. if __name__ == "__main__":
  29. # get_association_title_list_in_multi_threads()
  30. get_association_title_list_in_multi_threads()
  31. # get each platform
  32. platform_list = ["sph", "hksp", "toutiao", "gzh"]
  33. for platform_id in platform_list:
  34. deal_each_platform(platform=platform_id)