12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- """
- @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:
- error_msg = traceback.format_exc()
- bot(
- title='账号抓取v1执行失败',
- detail={
- "error": str(e),
- "traceback": error_msg
- }
- )
- # 再执行文章抓取
- try:
- video_crawler.run()
- except Exception as e:
- error_msg = traceback.format_exc()
- bot(
- title='视频抓取执行失败',
- detail={
- "error": str(e),
- "traceback": error_msg
- }
- )
- # 再执行账号抓取v2
- try:
- account_crawler.run_v2()
- except Exception as e:
- error_msg = traceback.format_exc()
- bot(
- title='账号抓取V2执行失败',
- detail={
- "error": str(e),
- "traceback": error_msg
- }
- )
- if __name__ == '__main__':
- main()
|