introduce success_count and total_duration (proxylist.sqlit
run those commands to update the database: sqlite3 proxylist.sqlite "alter table proxylist add success_count int" sqlite3 proxylist.sqlite "alter table proxylist add total_duration int" sqlite3 proxylist.sqlite "update proxylist set success_count=0,total_duration=0"
This commit is contained in:
6
ppf.py
6
ppf.py
@@ -58,10 +58,10 @@ def insert_proxies(proxies, uri, sqlite):
|
||||
|
||||
query = [ 'proxy=?' for p in proxies ]
|
||||
known = [ i[0] for i in sqlite.execute('SELECT proxy FROM proxylist WHERE %s' % ' OR '.join(query), proxies).fetchall() ]
|
||||
new = [ (time_now,i,3,0) for i in proxies if not i in known ]
|
||||
new = [ (time_now,i,3,0,0,0) for i in proxies if not i in known ]
|
||||
|
||||
if len(new):
|
||||
sqlite.executemany('INSERT INTO proxylist (added,proxy,failed,tested) VALUES (?,?,?,?)', new)
|
||||
sqlite.executemany('INSERT INTO proxylist (added,proxy,failed,tested,success_count,total_duration) VALUES (?,?,?,?,?,?)', new)
|
||||
sqlite.commit()
|
||||
_log('+%d item(s) from %s' % (len(new), uri), 'added')
|
||||
time.sleep(0.1)
|
||||
@@ -158,7 +158,7 @@ if __name__ == '__main__':
|
||||
|
||||
## create dbs if required
|
||||
sqlite.execute('CREATE TABLE IF NOT EXISTS uris (added INT, url TEXT, check_time INT, error INT, driver INT, hash TEXT)')
|
||||
sqlite.execute('CREATE TABLE IF NOT EXISTS proxylist (proxy BLOB, country BLOB, added INT, failed INT, tested INT, dronebl INT, proto TEXT, duration INT)')
|
||||
sqlite.execute('CREATE TABLE IF NOT EXISTS proxylist (proxy BLOB, country BLOB, added INT, failed INT, tested INT, dronebl INT, proto TEXT, duration INT, success_count INT, total_duration INT)')
|
||||
sqlite.commit()
|
||||
|
||||
import_from_file('import.txt', sqlite)
|
||||
|
||||
Reference in New Issue
Block a user