소스 검색

2024-06-04
取消微信搜索接口服务

罗俊辉 10 달 전
부모
커밋
98bba346c3
2개의 변경된 파일37개의 추가작업 그리고 32개의 파일을 삭제
  1. 6 2
      applications/search/hksp_search.py
  2. 31 30
      applications/search/weixin_search.py

+ 6 - 2
applications/search/hksp_search.py

@@ -89,8 +89,12 @@ def hksp_search(key, sensitive_words):
         'x-requested-with': 'xmlhttprequest',
         'x-requested-with': 'xmlhttprequest',
     }
     }
     # 发送GET请求
     # 发送GET请求
-    response = requests.get(url, headers=headers, params=params, proxies=tunnel_proxies()).json()
-    print(json.dumps(response, ensure_ascii=False, indent=4))
+    response = requests.get(
+        url,
+        headers=headers,
+        params=params,
+        proxies=tunnel_proxies()
+    ).json()
     try:
     try:
         data_list = response['data']['list']
         data_list = response['data']['list']
         L = []
         L = []

+ 31 - 30
applications/search/weixin_search.py

@@ -14,33 +14,34 @@ def wx_search(keys, sensitive_words):
     :param keys:
     :param keys:
     :return:
     :return:
     """
     """
-    url = "http://8.217.190.241:8888/crawler/wei_xin/keyword"
-    payload = json.dumps({
-        "keyword": keys,
-        "cursor": "0",
-        "content_type": "video"
-    })
-    headers = {
-        'Content-Type': 'application/json'
-    }
-    response = requests.request("POST", url, headers=headers, data=payload).json()
-    if response['msg'] == '未知错误':
-        return []
-    else:
-        L = []
-        if response['data']:
-            video_list = response['data']['data']
-            if video_list:
-                for video in video_list:
-                    try:
-                        video_info = video['items'][0]
-                        title = video_info['title']
-                        duration_str = video_info['duration']
-                        dr = int(duration_str.split(":")[0].strip()) + int(duration_str.split(":")[1].strip())
-                        if sensitive_flag(sensitive_words, title) and dr <= 300:
-                            L.append(video_info)
-                        else:
-                            continue
-                    except:
-                        pass
-        return L
+    return []
+    # url = "http://8.217.190.241:8888/crawler/wei_xin/keyword"
+    # payload = json.dumps({
+    #     "keyword": keys,
+    #     "cursor": "0",
+    #     "content_type": "video"
+    # })
+    # headers = {
+    #     'Content-Type': 'application/json'
+    # }
+    # response = requests.request("POST", url, headers=headers, data=payload).json()
+    # if response['msg'] == '未知错误':
+    #     return []
+    # else:
+    #     L = []
+    #     if response['data']:
+    #         video_list = response['data']['data']
+    #         if video_list:
+    #             for video in video_list:
+    #                 try:
+    #                     video_info = video['items'][0]
+    #                     title = video_info['title']
+    #                     duration_str = video_info['duration']
+    #                     dr = int(duration_str.split(":")[0].strip()) + int(duration_str.split(":")[1].strip())
+    #                     if sensitive_flag(sensitive_words, title) and dr <= 300:
+    #                         L.append(video_info)
+    #                     else:
+    #                         continue
+    #                 except:
+    #                     pass
+    #     return L