mirror of
https://github.com/soimort/you-get.git
synced 2025-01-24 05:55:02 +03:00
Merge branch 'hjk41-socks' into develop
This commit is contained in:
commit
1c40581fc7
@ -1214,15 +1214,18 @@ def script_main(script_name, download, download_playlist, **kwargs):
|
|||||||
|
|
||||||
if (socks_proxy):
|
if (socks_proxy):
|
||||||
try:
|
try:
|
||||||
import socket
|
import socket
|
||||||
import socks
|
import socks
|
||||||
socks_proxy_addrs = socks_proxy.split(':')
|
socks_proxy_addrs = socks_proxy.split(':')
|
||||||
socks.set_default_proxy(socks.SOCKS5,
|
socks.set_default_proxy(socks.SOCKS5,
|
||||||
socks_proxy_addrs[0],
|
socks_proxy_addrs[0],
|
||||||
int(socks_proxy_addrs[1]))
|
int(socks_proxy_addrs[1]))
|
||||||
socket.socket = socks.socksocket
|
socket.socket = socks.socksocket
|
||||||
|
def getaddrinfo(*args):
|
||||||
|
return [(socket.AF_INET, socket.SOCK_STREAM, 6, '', (args[0], args[1]))]
|
||||||
|
socket.getaddrinfo = getaddrinfo
|
||||||
except ImportError:
|
except ImportError:
|
||||||
log.w('Error importing PySocks library, socks proxy ignored.'
|
log.w('Error importing PySocks library, socks proxy ignored.'
|
||||||
'In order to use use socks proxy, please install PySocks.')
|
'In order to use use socks proxy, please install PySocks.')
|
||||||
else:
|
else:
|
||||||
import socket
|
import socket
|
||||||
|
Loading…
Reference in New Issue
Block a user