Explorar el Código

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

罗俊辉 hace 1 año
padre
commit
5cf5a3137f

+ 16 - 15
applications/schedule/search_schedule.py

@@ -79,21 +79,22 @@ def search_videos(video_path, title, trace_id, gh_id):
     :return:
     """
     recall_obj = recall_search_video(video_path, title, trace_id)
-    platform = recall_obj["platform"]
-    recall_video = recall_obj["result"]
-    if recall_video:
-        logging(
-            code="7002",
-            info="视频搜索成功, 搜索平台为--{}".format(platform),
-            trace_id=trace_id,
-            data=recall_video
-        )
-        video_mq_sender(
-            video_obj=recall_video,
-            user=gh_id_dict.get(gh_id),
-            trace_id=trace_id,
-            platform=platform
-        )
+    if recall_obj:
+        platform = recall_obj["platform"]
+        recall_video = recall_obj["result"]
+        if recall_video:
+            logging(
+                code="7002",
+                info="视频搜索成功, 搜索平台为--{}".format(platform),
+                trace_id=trace_id,
+                data=recall_video
+            )
+            video_mq_sender(
+                video_obj=recall_video,
+                user=gh_id_dict.get(gh_id),
+                trace_id=trace_id,
+                platform=platform
+            )
     else:
         logging(
             code="7003",

+ 2 - 0
applications/search/hksp_search.py

@@ -102,6 +102,8 @@ def hksp_search(key):
     }
     # 发送GET请求
     response = requests.get(url, headers=headers, params=params).json()
+    print("baidu search")
+    print(response)
     try:
         data_list = response['data']['list']
         L = []

+ 3 - 1
applications/search/xigua_search.py

@@ -212,11 +212,13 @@ def xigua_search(keyword):
                 video_d = XiGuaFunctions().get_video_info(doc_id)
                 video_title = video_d['video_title']
                 if sensitive_flag(sensitive_words, video_title) and int(video_d['duration']) <= 300:
+                    print("西瓜视频信息")
+                    print(video_d)
                     L.append(video_d)
                 else:
                     continue
             except Exception as e:
-                print(e)
+                # print(e)
                 continue
         return L
     else: