|
@@ -47,27 +47,34 @@ async def search_videos_from_the_web():
|
|
|
function="search_videos_from_the_web",
|
|
|
trace_id=trace_id
|
|
|
)
|
|
|
- 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
|
|
|
+ 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:
|
|
|
+ ask_kimi_and_save_to_local((title, trace_id, title_p))
|
|
|
+ await asyncio.sleep(2)
|
|
|
+ search_videos(
|
|
|
+ title=title,
|
|
|
+ video_path=title_p,
|
|
|
+ trace_id=trace_id,
|
|
|
+ gh_id=gh_id,
|
|
|
)
|
|
|
- else:
|
|
|
- ask_kimi_and_save_to_local((title, trace_id, title_p))
|
|
|
- await asyncio.sleep(2)
|
|
|
- search_videos(
|
|
|
- title=title,
|
|
|
- video_path=title_p,
|
|
|
- trace_id=trace_id,
|
|
|
- gh_id=gh_id,
|
|
|
- )
|
|
|
- res = {
|
|
|
- "trace_id": trace_id,
|
|
|
- "code": 0
|
|
|
- }
|
|
|
+ res = {
|
|
|
+ "trace_id": trace_id,
|
|
|
+ "code": 0
|
|
|
+ }
|
|
|
+ except Exception as e:
|
|
|
+ res = {
|
|
|
+ "trace_id": trace_id,
|
|
|
+ "code": 1,
|
|
|
+ "message": str(e)
|
|
|
+ }
|
|
|
return jsonify(res)
|
|
|
|
|
|
|