浏览代码

download video fails
add bot to dy_spider && baidu spider

luojunhui 5 月之前
父节点
当前提交
6072520df6
共有 3 个文件被更改,包括 27 次插入1 次删除
  1. 14 0
      applications/search/dy_search.py
  2. 11 0
      applications/search/hksp_search.py
  3. 2 1
      tasks/newContentIdTask.py

+ 14 - 0
applications/search/dy_search.py

@@ -2,10 +2,13 @@
 @author: luojunhui
 """
 import json
+import traceback
+
 import requests
 
 from applications.functions.common import sensitive_flag
 from applications.log import logging
+from applications.feishu import bot
 
 
 def douyin_search(keyword, sensitive_words, trace_id):
@@ -45,6 +48,7 @@ def douyin_search(keyword, sensitive_words, trace_id):
                 else:
                     continue
             except Exception as e:
+                print(traceback.format_exc())
                 continue
         logging(
             code="8001",
@@ -56,6 +60,16 @@ def douyin_search(keyword, sensitive_words, trace_id):
             },
             trace_id=trace_id
         )
+        if not L and len(dt_list) > 0:
+            bot(
+                title="抖音搜索失败",
+                detail={
+                    "keys": keyword,
+                    "搜索的视频数量": len(dt_list),
+                    "详情请求的视频数量": len(L)
+                },
+                mention=False
+            )
         return L
     except Exception as e:
         logging(

+ 11 - 0
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.feishu import bot
 
 
 def tunnel_proxies():
@@ -130,6 +131,16 @@ def hksp_search(key, sensitive_words, trace_id):
             },
             trace_id=trace_id
         )
+        if not L and len(data_list) > 0:
+            bot(
+                title="抖音搜索失败",
+                detail={
+                    "keys": key,
+                    "搜索的视频数量": len(data_list),
+                    "详情请求的视频数量": len(L)
+                },
+                mention=False
+            )
         return L
     except Exception as e:
         logging(

+ 2 - 1
tasks/newContentIdTask.py

@@ -603,7 +603,8 @@ class NewContentIdTask(object):
                         "success_count": downloaded_count,
                         "total_count": len(videos_need_to_download_tuple),
                         "content_id": content_id
-                    }
+                    },
+                    mention=False
                 )
                 return False