Browse Source

re_search接口

罗俊辉 11 months ago
parent
commit
94e60f9722
1 changed files with 38 additions and 0 deletions
  1. 38 0
      applications/routes.py

+ 38 - 0
applications/routes.py

@@ -107,4 +107,42 @@ def Routes(mysql_client):
             print(result)
         return jsonify(result)
 
+    @my_blueprint.route('/re_search_videos', methods=['POST'])
+    async def re_search_videos():
+        """
+        重新搜索
+        :return:
+        """
+        params = await request.get_json()
+        gh_id = params['ghId']
+        trace_id = params['trace_id']
+        logging(
+            code="2000",
+            info="重新搜索视频内容接口请求成功",
+            port="title_to_search",
+            function="re_search_videos_from_the_web",
+            trace_id=trace_id
+        )
+        try:
+            asyncio.ensure_future(
+                search_videos(
+                    params=params,
+                    trace_id=trace_id,
+                    gh_id=gh_id,
+                    mysql_client=mysql_client
+                )
+            )
+            res = {
+                "status": "success",
+                "code": 0,
+                "traceId": trace_id
+            }
+        except Exception as e:
+            res = {
+                "status": "fail",
+                "code": 1,
+                "message": str(e)
+            }
+        return jsonify(res)
+
     return my_blueprint