소스 검색

2024-06-13
异步定时任务

罗俊辉 1 년 전
부모
커밋
b4cec0dc8e
1개의 변경된 파일6개의 추가작업 그리고 2개의 파일을 삭제
  1. 6 2
      applications/search/dy_search.py

+ 6 - 2
applications/search/dy_search.py

@@ -40,7 +40,8 @@ def douyin_search(keyword, sensitive_words, trace_id):
                 duration = int(obj['duration'])
                 if sensitive_flag(sensitive_words, title) and duration < 30000:
                     res = douyin_detail(video_id)
-                    L.append(res)
+                    if res:
+                        L.append(res)
                 else:
                     continue
             except Exception as e:
@@ -80,4 +81,7 @@ def douyin_detail(video_id):
     }
     response = requests.request("POST", url, headers=headers, data=payload).json()
     video_info = response['data']['data']
-    return video_info
+    if video_info['content_type'] == "note":
+        return None
+    else:
+        return video_info