Browse Source

download video fails

luojunhui 5 months ago
parent
commit
429c2acbb9
1 changed files with 13 additions and 6 deletions
  1. 13 6
      tasks/newContentIdTask.py

+ 13 - 6
tasks/newContentIdTask.py

@@ -4,8 +4,6 @@
 import json
 import time
 
-import asyncio
-
 from applications.config import Config
 from applications.log import logging
 from applications.functions.pqFunctions import publish_to_pq, get_pq_video_detail
@@ -523,10 +521,10 @@ class NewContentIdTask(object):
                     if not file_path:
                         # 说明视频下载失败,无需上传该视频, 将该条记录设置为失败状态
                         update_sql = f"""
-                                            UPDATE {self.article_crawler_video_table}
-                                            SET download_status = %s
-                                            WHERE id = %s;
-                                            """
+                                    UPDATE {self.article_crawler_video_table}
+                                    SET download_status = %s
+                                    WHERE id = %s;
+                        """
                         await self.mysql_client.async_insert(
                             sql=update_sql,
                             params=(VIDEO_DOWNLOAD_FAIL_STATUS, params['id'])
@@ -598,6 +596,15 @@ class NewContentIdTask(object):
                     process_times=process_times + 1,
                     trace_id=trace_id
                 )
+                bot(
+                    title="视频下载失败",
+                    detail={
+                        "trace_id": trace_id,
+                        "success_count": downloaded_count,
+                        "total_count": len(videos_need_to_download_tuple),
+                        "content_id": content_id
+                    }
+                )
                 return False
 
     async def publish_task(self, params, kimi_title):