浏览代码

nlp取消jcd兜底
视频时长控制在300s

luojunhui 3 月之前
父节点
当前提交
cc2694c067
共有 3 个文件被更改,包括 7 次插入2 次删除
  1. 3 0
      applications/const/server_const.py
  2. 2 1
      applications/search/dy_search.py
  3. 2 1
      applications/search/hksp_search.py

+ 3 - 0
applications/const/server_const.py

@@ -67,6 +67,9 @@ class ServerConst:
 
     JCD_SIMILARITY_THRESHOLD = 0
 
+    # 视频时长(s)
+    MAX_VIDEO_DURATION = 300
+
 
 
 

+ 2 - 1
applications/search/dy_search.py

@@ -7,6 +7,7 @@ import requests
 
 from applications.functions.common import sensitive_flag
 from applications.log import logging
+from applications.const import server_const
 
 
 def douyin_search(keyword, sensitive_words, trace_id):
@@ -44,7 +45,7 @@ def douyin_search(keyword, sensitive_words, trace_id):
                 title = obj['video_desc']
                 video_id = obj['video_id']
                 duration = int(obj['duration'])
-                if sensitive_flag(sensitive_words, title) and duration < 30000:
+                if sensitive_flag(sensitive_words, title) and duration < server_const.MAX_VIDEO_DURATION * 1000:
                     res = douyin_detail(video_id)
                     if res:
                         L.append(res)

+ 2 - 1
applications/search/hksp_search.py

@@ -13,6 +13,7 @@ from fake_useragent import FakeUserAgent
 
 from applications.functions.common import sensitive_flag
 from applications.log import logging
+from applications.const import server_const
 
 
 def tunnel_proxies():
@@ -117,7 +118,7 @@ def hksp_search(key, sensitive_words, trace_id):
                 video_id = data['vid']
                 title = data['title']
                 duration = int(data['duration'].split(":")[0]) * 60 + int(data['duration'].split(":")[1])
-                if sensitive_flag(sensitive_words, title) and int(duration) <= 300:
+                if sensitive_flag(sensitive_words, title) and int(duration) <= server_const.MAX_VIDEO_DURATION:
                     res = get_video_detail(video_id)
                     L.append(res)
                 else: