fix: url → self.url, make thread option configurable
This commit is contained in:
6
ppf.py
6
ppf.py
@@ -241,7 +241,7 @@ class Leechered(threading.Thread):
|
||||
def run(self):
|
||||
self.status = 'nok'
|
||||
|
||||
if not self.content_type: self.content_type = get_content_type(url)
|
||||
if not self.content_type: self.content_type = get_content_type(self.url)
|
||||
|
||||
if is_good_content_type(self.content_type):
|
||||
try: content = fetch.fetch_contents(self.url)
|
||||
@@ -318,7 +318,7 @@ if __name__ == '__main__':
|
||||
if (time.time() - reqtime) > 3:
|
||||
rows = urldb.execute(qurl, (config.ppf.max_fail, config.ppf.checktime, config.ppf.perfail_checktime, int(time.time()))).fetchall()
|
||||
reqtime = time.time()
|
||||
if len(rows) < 5:
|
||||
if len(rows) < config.ppf.threads:
|
||||
rows = []
|
||||
|
||||
for thread in threads:
|
||||
@@ -328,7 +328,7 @@ if __name__ == '__main__':
|
||||
if len(proxylist): dbs.insert_proxies(proxydb, proxylist, url)
|
||||
|
||||
threads = [ thread for thread in threads if thread.is_alive() ]
|
||||
if len(threads) < 5 and len(rows):
|
||||
if len(threads) < config.ppf.threads and len(rows):
|
||||
row = random.choice(rows)
|
||||
rows.remove(row)
|
||||
t = Leechered(row[0], row[1], row[2], row[3], row[4], row[5])
|
||||
|
||||
Reference in New Issue
Block a user