Przeglądaj źródła

抓取部分执行任务

luojunhui 4 miesięcy temu
rodzic
commit
5f2663ce47
2 zmienionych plików z 60 dodań i 0 usunięć
  1. 2 0
      coldStartTasks/crawler/__init__.py
  2. 58 0
      run_video_account_crawler.py

+ 2 - 0
coldStartTasks/crawler/__init__.py

@@ -1,3 +1,5 @@
 """
 @author: luojunhui
 """
+from .weixin_account_crawler import WeixinAccountCrawler
+from .weixin_video_crawler import WeixinVideoCrawler

+ 58 - 0
run_video_account_crawler.py

@@ -0,0 +1,58 @@
+"""
+@author: luojunhui
+执行视频&&账号的抓取
+"""
+import traceback
+
+from applications import bot
+from coldStartTasks.crawler import WeixinAccountCrawler, WeixinVideoCrawler
+
+account_crawler = WeixinAccountCrawler()
+video_crawler = WeixinVideoCrawler()
+
+
+def main():
+    """
+    主函数
+    :return:
+    """
+    # 先执行账号抓取
+    try:
+        account_crawler.run()
+    except Exception as e:
+        traceback.print_exc()
+        bot(
+            title='账号抓取v1执行失败',
+            detail={
+                "error": str(e),
+                "traceback": traceback.format_exc()
+            }
+        )
+    # 再执行文章抓取
+    try:
+        video_crawler.run()
+    except Exception as e:
+        traceback.print_exc()
+        bot(
+            title='视频抓取执行失败',
+            detail={
+                "error": str(e),
+                "traceback": traceback.format_exc()
+            }
+        )
+    # 再执行账号抓取v2
+    try:
+        account_crawler.run_v2()
+    except Exception as e:
+        traceback.print_exc()
+        bot(
+            title='账号抓取V2执行失败',
+            detail={
+                "error": str(e),
+                "traceback": traceback.format_exc()
+            }
+        )
+
+
+if __name__ == '__main__':
+    main()