Explorar o código

2024-06-13
异步定时任务

罗俊辉 hai 1 ano
pai
achega
e6b6588bd4
Modificáronse 1 ficheiros con 3 adicións e 2 borrados
  1. 3 2
      applications/search/dy_search.py

+ 3 - 2
applications/search/dy_search.py

@@ -37,7 +37,8 @@ def douyin_search(keyword, sensitive_words, trace_id):
             try:
                 title = obj['video_desc']
                 video_id = obj['video_id']
-                if sensitive_flag(sensitive_words, title):
+                duration = int(obj['duration'])
+                if sensitive_flag(sensitive_words, title) and duration < 30000:
                     res = douyin_detail(video_id)
                     L.append(res)
                 else:
@@ -79,4 +80,4 @@ def douyin_detail(video_id):
     }
     response = requests.request("POST", url, headers=headers, data=payload).json()
     video_info = response['data']['data']
-    return video_info
+    return video_info