|
@@ -55,8 +55,7 @@ def get_video_detail(video_id):
|
|
|
url,
|
|
|
headers=headers,
|
|
|
params=params,
|
|
|
- proxies=tunnel_proxies(),
|
|
|
- verify=False
|
|
|
+ proxies=tunnel_proxies()
|
|
|
).json()
|
|
|
time.sleep(2)
|
|
|
return response['data']['apiData']['curVideoMeta']
|
|
@@ -68,7 +67,7 @@ def hksp_search(key, sensitive_words):
|
|
|
"""
|
|
|
timestamp_seconds = time.time()
|
|
|
timestamp_milliseconds = int(timestamp_seconds * 1000)
|
|
|
- url = 'http://haokan.baidu.com/haokan/ui-search/pc/search/video'
|
|
|
+ url = 'https://haokan.baidu.com/haokan/ui-search/pc/search/video'
|
|
|
# 定义请求的参数
|
|
|
strings = "{}_{}_{}_{}_{}".format(1, urllib.parse.quote(key), 10, timestamp_milliseconds, 1)
|
|
|
sign = hashlib.md5(strings.encode()).hexdigest()
|
|
@@ -97,9 +96,7 @@ def hksp_search(key, sensitive_words):
|
|
|
headers=headers,
|
|
|
params=params,
|
|
|
proxies=tunnel_proxies(),
|
|
|
- timeout=30,
|
|
|
- verify=False
|
|
|
-
|
|
|
+ timeout=30
|
|
|
).json()
|
|
|
try:
|
|
|
data_list = response['data']['list']
|
|
@@ -119,4 +116,8 @@ def hksp_search(key, sensitive_words):
|
|
|
pass
|
|
|
return L
|
|
|
except:
|
|
|
- return []
|
|
|
+ return []
|
|
|
+
|
|
|
+w = hksp_search("中华人民共和国", sensitive_words=["123"])
|
|
|
+
|
|
|
+print(w)
|