浏览代码

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

罗俊辉 11 月之前
父节点
当前提交
49f1bc0346
共有 3 个文件被更改,包括 12 次插入5 次删除
  1. 1 2
      applications/functions/video_item.py
  2. 11 1
      applications/schedule/main_schedule.py
  3. 0 2
      applications/search/hksp_search.py

+ 1 - 2
applications/functions/video_item.py

@@ -111,7 +111,6 @@ class VideoItem(object):
 class VideoProducer(object):
     """
     处理视频
-    todo: baidu && xigua video process
     """
 
     @classmethod
@@ -163,7 +162,7 @@ class VideoProducer(object):
         item.add_video_info("cover_url", video_obj["poster"])
         item.add_video_info("out_video_id", video_obj['id'])
         item.add_video_info("out_user_id", trace_id)
-        item.add_video_info("like_cnt", video_obj['like'])
+        item.add_video_info("like_cnt", video_obj['like'] if video_obj.get('like') else 0)
         item.add_video_info("play_cnt", video_obj['playcnt'])
         item.add_video_info("duration", video_obj['duration'])
         item.add_video_info("platform", platform)

+ 11 - 1
applications/schedule/main_schedule.py

@@ -68,13 +68,23 @@ class AskForInfo:
 
         :return:
         """
+        a = time.time()
         res = self.search_request()
+        b = time.time()
+        print("search_time")
+        print(b - a)
         if res['code'] == 0:
             trace_id = res["trace_id"]
             kimi_title = res['kimi_title']
+            c = time.time()
             res_obj = self.check_out_videos(trace_id=trace_id)
-            time.sleep(3)
+            d = time.time()
+            print("recall time")
+            print(d - c)
             final_obj = self.ask_for_info(res_obj=res_obj, kt=kimi_title)
+            e = time.time()
+            print("ask time")
+            print(e - d)
             return final_obj
         elif res['code'] == 1:
             return {

+ 0 - 2
applications/search/hksp_search.py

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