fix socks DNS resolve issue

This commit is contained in:
Chuntao Hong 2016-07-20 15:18:28 +08:00
parent 5295d1160c
commit fdb1809455

View File

@ -1221,6 +1221,9 @@ def script_main(script_name, download, download_playlist, **kwargs):
socks_proxy_addrs[0],
int(socks_proxy_addrs[1]))
socket.socket = socks.socksocket
def getaddrinfo(*args):
return [(socket.AF_INET, socket.SOCK_STREAM, 6, '', (args[0], args[1]))]
socket.getaddrinfo = getaddrinfo
except ImportError:
log.w('Error importing PySocks library, socks proxy ignored.'
'In order to use use socks proxy, please install PySocks.')