The only downloader you need. 下载器的集大成者。
TypeScript asyncasynciobittorentbtcross-platformdownload-managerdownloaderfluent-designftphttp3magnetpyqtpyside6pythonqtquicreactsoftwarestreaming
feat(bt): 支持 http/https/socks4 代理
XiaoYouChR9d25f4c50218
diff --git a/features/bittorrent_pack/pack.py b/features/bittorrent_pack/pack.pyindex a7b0db05..719b4155 100644--- a/features/bittorrent_pack/pack.py+++ b/features/bittorrent_pack/pack.py@@ -101,7 +101,7 @@ class TorrentParser(TaskParser):class BitTorrentPack(FeaturePack):packId = "bt"config = bittorrentConfig- proxySchemes = {"socks5"}+ proxySchemes = {"http", "https", "socks4", "socks5"}parsers = [TorrentParser]taskCards = {BTTask: BTTaskCard}draftCards = {BTTask: BTDraftCard}diff --git a/features/bittorrent_pack/session.py b/features/bittorrent_pack/session.pyindex 48f4f096..1ff95d11 100644--- a/features/bittorrent_pack/session.py+++ b/features/bittorrent_pack/session.py@@ -45,6 +45,20 @@ ALERT_MASK = (DHT_STATE_FILE = "bt_dht_state.dat"+PROXY_TYPES = {+ "http": lt.proxy_type_t.http,+ "https": lt.proxy_type_t.http,+ "socks4": lt.proxy_type_t.socks4,+ "socks5": lt.proxy_type_t.socks5,+ "socks5h": lt.proxy_type_t.socks5,+}+PROXY_TYPES_AUTH = {+ "http": lt.proxy_type_t.http_pw,+ "https": lt.proxy_type_t.http_pw,+ "socks5": lt.proxy_type_t.socks5_pw,+ "socks5h": lt.proxy_type_t.socks5_pw,+}+_ERROR_ALERTS = (lt.file_error_alert,lt.metadata_failed_alert,@@ -528,11 +542,19 @@ class BTSession(QObject):if not url:return {}parsed = urlsplit(url)- if parsed.scheme.lower() not in {"socks5", "socks5h"} or not parsed.hostname or not parsed.port:+ scheme = parsed.scheme.lower()+ if not parsed.hostname or not parsed.port:return {}hasCredentials = bool(parsed.username or parsed.password)+ proxyType = PROXY_TYPES_AUTH.get(scheme) if hasCredentials else None+ if proxyType is None:+ proxyType = PROXY_TYPES.get(scheme)+ if proxyType is None:+ return {}+ if scheme == "socks4" and hasCredentials:+ logger.warning("SOCKS4 不支持认证,凭据将被忽略")return {- "proxy_type": lt.proxy_type_t.socks5_pw if hasCredentials else lt.proxy_type_t.socks5,+ "proxy_type": proxyType,"proxy_hostname": parsed.hostname,"proxy_port": parsed.port,"proxy_username": parsed.username or "",