-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.py
More file actions
53 lines (42 loc) · 1.87 KB
/
Copy pathmain.py
File metadata and controls
53 lines (42 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
from modules import LeFigaro, SeLoger, BienIci, LogicImmo, IADFrance, NotairesFrance, VinciImmobilier, ImmobilierFrance
from modules.utils import logger
import threading, time
class Main:
def __init__(self):
self.runningThreads = []
self.modules = [
LeFigaro.LeFigaroModule(),
SeLoger.SeLogerModule(),
LogicImmo.LogicImmoModule(),
BienIci.BienIciModule(),
IADFrance.IADFranceModule(),
NotairesFrance.NotairesFranceModule(),
VinciImmobilier.VinciImmobilierModule(),
ImmobilierFrance.ImmobilierFranceModule()
]
self.logger = logger.Logger("Main")
self.logger.info(f'Loaded {len(self.modules)} module(s)')
def Run(self):
successfullyRan = 0
self.logger.info('Running modules...')
# runs the modules each one by one
for m in self.modules:
try:
t = threading.Thread(target=m.start)
self.runningThreads.append(t)
t.start()
successfullyRan += 1
self.logger.success(f'Module "{m.name}" has been started, and is now crawling.')
except Exception as err:
self.logger.error(f'Failed to launch module named "{m.name}"! (Error: {err})')
self.logger.info(f'{successfullyRan} module(s) are runnings.')
while True:
totalFound = 0
for m in self.modules:
self.logger.warning(f' Module > {m.name} | ADs Scrapped: {m.current_scrapped_ads}/{m.total_ads_found}')
totalFound += int(m.current_scrapped_ads)
self.logger.warning(f' Main > Total ADs Scrapped: {totalFound} | Waiting 5s before refreshing...')
time.sleep(5)
if __name__ == "__main__":
m = Main()
m.Run()