add socks5h proxy support

This commit is contained in:
Max Zhao
2020-08-03 22:57:24 +08:00
parent 6d87b05fee
commit 362539bbda
2 changed files with 4 additions and 3 deletions

View File

@@ -3,6 +3,7 @@ from lxml import etree
import config import config
SUPPORT_PROXY_TYPE = ("http", "socks5", "socks5h")
def get_data_state(data: dict) -> bool: # 元数据获取失败检测 def get_data_state(data: dict) -> bool: # 元数据获取失败检测
if "title" not in data or "number" not in data: if "title" not in data or "number" not in data:
@@ -27,8 +28,8 @@ def get_proxy(proxy: str, proxytype: str = None) -> dict:
''' 获得代理参数默认http代理 ''' 获得代理参数默认http代理
''' '''
if proxy: if proxy:
if proxytype.startswith("socks"): if proxytype in SUPPORT_PROXY_TYPE:
proxies = {"http": "socks5://" + proxy, "https": "socks5://" + proxy} proxies = {"http": proxytype + "://" + proxy, "https": proxytype + "://" + proxy}
else: else:
proxies = {"http": "http://" + proxy, "https": "https://" + proxy} proxies = {"http": "http://" + proxy, "https": "https://" + proxy}
else: else:

View File

@@ -5,7 +5,7 @@ success_output_folder=JAV_output
soft_link=0 soft_link=0
[proxy] [proxy]
;proxytype: http or socks5 ;proxytype: http or socks5 or socks5h
type=http type=http
proxy=127.0.0.1:1080 proxy=127.0.0.1:1080
timeout=10 timeout=10