Explorar el Código

2024-05-13
多平台搜索上线(微信, 百度, 西瓜)
弃用 search_keys, theme
搜索结果过pq敏感词策略

罗俊辉 hace 1 año
padre
commit
40160a83e0
Se han modificado 1 ficheros con 29 adiciones y 29 borrados
  1. 29 29
      applications/routes.py

+ 29 - 29
applications/routes.py

@@ -47,36 +47,36 @@ async def search_videos_from_the_web():
         function="search_videos_from_the_web",
         trace_id=trace_id
     )
-    try:
-        title_p = os.path.join(os.getcwd(), 'applications', 'static', "titles", "{}.json".format(title))
-        if os.path.exists(title_p):
-            logging(
-                code="2001",
-                info="该标题已经被 kimi 处理过,跳过请求 kimi 操作--- {}".format(title),
-                function="search_videos_from_the_web",
-                trace_id=trace_id
-            )
-        else:
-            KimiServer().ask_kimi_and_save_to_local((title, trace_id, title_p))
-        await asyncio.sleep(1)
-        kimi_title = KimiServer().kimi_title(title)
-        search_videos(
-            title=title,
-            video_path=title_p,
-            trace_id=trace_id,
-            gh_id=gh_id,
+    # try:
+    title_p = os.path.join(os.getcwd(), 'applications', 'static', "titles", "{}.json".format(title))
+    if os.path.exists(title_p):
+        logging(
+            code="2001",
+            info="该标题已经被 kimi 处理过,跳过请求 kimi 操作--- {}".format(title),
+            function="search_videos_from_the_web",
+            trace_id=trace_id
         )
-        res = {
-            "trace_id": trace_id,
-            "code": 0,
-            "kimi_title": kimi_title
-        }
-    except Exception as e:
-        res = {
-            "trace_id": trace_id,
-            "code": 1,
-            "message": str(e)
-        }
+    else:
+        KimiServer().ask_kimi_and_save_to_local((title, trace_id, title_p))
+    await asyncio.sleep(1)
+    kimi_title = KimiServer().kimi_title(title)
+    search_videos(
+        title=title,
+        video_path=title_p,
+        trace_id=trace_id,
+        gh_id=gh_id,
+    )
+    res = {
+        "trace_id": trace_id,
+        "code": 0,
+        "kimi_title": kimi_title
+    }
+    # except Exception as e:
+    #     res = {
+    #         "trace_id": trace_id,
+    #         "code": 1,
+    #         "message": str(e)
+    #     }
     return jsonify(res)