def start_StartCrawler(self): database = DataBase( host_db=self.host_db, user_db=self.user_db, password_db=self.password_db, database=self.database, ) database.clear() self.logger.info(' Iniciando o processo de Crawler') tor = TorConnect( telegram_chat_id=self.telegram_chat_id, telegram_token=self.telegram_token, host_db=self.host_db, user_db=self.user_db, password_db=self.password_db, database=self.database, ) tor.start
def start(self): self.header = header() self.header.start start_framework = None if self.args.debug: logging.basicConfig(level=logging.DEBUG) else: logging.basicConfig( level=logging.INFO, format= '%(asctime)s.%(msecs)03d %(levelname)s %(module)s - %(funcName)s: %(message)s', datefmt='%Y-%m-%d %H:%M:%S', ) logging.getLogger('googleapicliet.discovery_cache').setLevel( logging.ERROR) if self.args.clear: database = DataBase( host_db=self.host_db, user_db=self.user_db, password_db=self.password_db, database=self.database, ) database.clear() if self.args.initial: self.initialdb() if self.args.StartList: self.logger = logging.getLogger('StartListURL') self.start_StartList() if self.args.StartGet: self.logger = logging.getLogger('GetStStartGetart') if self.args.framework is not None: self.start_StartGet(argument=self.args.framework) else: self.logger.error( ' Você precisa informar o framework que deseja usar\nEx: -Sc --framework github,gist\n\n' ) exit(0) if self.args.StartImport: self.logger = logging.getLogger('StartImport') if self.args.imput is not None: self.start_StartImport(argument=self.args.imput) else: self.logger.error( ' Você precisa informar o arquivo que deseja importar\nEx: -Si --imput /root/file.txt\n\n' ) exit(0) if self.args.StartCrawler: self.logger = logging.getLogger('StartCrawler') self.start_StartCrawler() if self.args.StartCrawlerURL: self.logger = logging.getLogger('StartCrawlerURL') self.start_StartCrawler_alone() if self.args.StartOrder: self.logger = logging.getLogger('StartCrawlerURLDESC') try: if isinstance(int(self.args.order), int): self.start_StartCrawler_order(number=int(self.args.order)) except ValueError as e: self.logger.error( ' Você precisa informar um número\nEx: -So --order 3\n\n') exit(1)