more random changes

This commit is contained in:
Your Name
2021-02-06 11:00:25 +01:00
parent e15b9d2994
commit 9aa2c91f41
3 changed files with 76 additions and 67 deletions

View File

@@ -83,9 +83,6 @@ class WorkerJob():
] ]
try: try:
if self.isoldies:
sock = rocksock.Rocksock(host=srv, port=server_port, ssl=use_ssl, proxies=proxies, timeout=config.watchd.timeout - 2)
else:
sock = rocksock.Rocksock(host=srv, port=server_port, ssl=use_ssl, proxies=proxies, timeout=config.watchd.timeout) sock = rocksock.Rocksock(host=srv, port=server_port, ssl=use_ssl, proxies=proxies, timeout=config.watchd.timeout)
sock.connect() sock.connect()
sock.send('NICK\n') sock.send('NICK\n')
@@ -276,7 +273,9 @@ class Proxywatchd():
q = 'SELECT proxy,proto,failed,success_count,total_duration,country FROM proxylist WHERE failed >= ? and failed < ? and (tested + ? + (failed * ?)) < ? ORDER BY RANDOM()' q = 'SELECT proxy,proto,failed,success_count,total_duration,country FROM proxylist WHERE failed >= ? and failed < ? and (tested + ? + (failed * ?)) < ? ORDER BY RANDOM()'
rows = self.mysqlite.execute(q, (0, config.watchd.max_fail, config.watchd.checktime, config.watchd.perfail_checktime, time.time())).fetchall() rows = self.mysqlite.execute(q, (0, config.watchd.max_fail, config.watchd.checktime, config.watchd.perfail_checktime, time.time())).fetchall()
# check oldies ? # check oldies ?
if len(rows) < config.watchd.threads and config.watchd.oldies: if len(rows) < config.watchd.threads:
rows = []
if config.watchd.oldies:
self.isoldies = True self.isoldies = True
## disable tor safeguard for old proxies ## disable tor safeguard for old proxies
if self.tor_safeguard: self.tor_safeguard = False if self.tor_safeguard: self.tor_safeguard = False

View File

@@ -19,12 +19,15 @@ with open('searx.instances') as h:
def proxyfind(sqlite = None, urignore=None): def proxyfind(sqlite = None, urignore=None):
search = '' search = ''
random.shuffle(searx_instances) random.shuffle(searx_instances)
## search by working proxy
if 'p' in config.scraper.query: if 'p' in config.scraper.query:
proxydb = mysqlite.mysqlite(config.watchd.database,str) proxydb = mysqlite.mysqlite(config.watchd.database,str)
proxies = [ i[0] for i in proxydb.execute('SELECT proxy FROM proxylist WHERE failed=0 ORDER BY RANDOM() LIMIT 10').fetchall() ] proxies = [ i[0] for i in proxydb.execute('SELECT proxy FROM proxylist WHERE failed=0 ORDER BY RANDOM() LIMIT 10').fetchall() ]
if len(proxies) and random.random() < random.random(): if len(proxies) and random.random() < random.random():
search = ' '.join( random.sample(proxies, random.randint(1,2))) search = ' '.join( random.sample(proxies, random.randint(1,2)))
## search by relative url
if 'w' in config.scraper.query and not len(search) or random.random() < random.random(): if 'w' in config.scraper.query and not len(search) or random.random() < random.random():
if not sqlite: sqlite = mysqlite.mysqlite(config.ppf.database,str) if not sqlite: sqlite = mysqlite.mysqlite(config.ppf.database,str)
uris = [ i[0] for i in sqlite.execute('SELECT url FROM uris WHERE error=0 and url not like "%github%" ORDER BY RANDOM() LIMIT 10').fetchall() ] uris = [ i[0] for i in sqlite.execute('SELECT url FROM uris WHERE error=0 and url not like "%github%" ORDER BY RANDOM() LIMIT 10').fetchall() ]
@@ -32,6 +35,7 @@ def proxyfind(sqlite = None, urignore=None):
if len(search): search = '%s OR ' % search if len(search): search = '%s OR ' % search
search = search + 'site:%s' % random.choice(uris).split('/')[2] search = search + 'site:%s' % random.choice(uris).split('/')[2]
## build string
if 's' in config.scraper.query and not len(search) or random.random() < random.random(): if 's' in config.scraper.query and not len(search) or random.random() < random.random():
if len(search): search = '%s OR ' % search if len(search): search = '%s OR ' % search
search = search + random.choice(search_terms) search = search + random.choice(search_terms)

View File

@@ -1,6 +1,8 @@
site:github.com :8081 :8888 :8080 elite proxylist
site:github.com :4444 :1234 :3124 elite http proxies
site:github.com proxylist elite socks proxies
anonymous proxies
anonymous proxylist
hourly http proxy hourly http proxy
hourly socks proxy hourly socks proxy
daily http proxy daily http proxy
@@ -11,3 +13,7 @@ updated http proxy list
updated socks proxy list updated socks proxy list
download http proxy download http proxy
download socks proxy download socks proxy
доверенное лицо
свежий список прокси
http прокси
socks прокси