def _get(self, url, sub_dir): capture = Capture(sub_dir, self.conf) browser = Browser(url, sub_dir, self.conf) links = [] try: capture.run() sleep(3) html = browser.get() links = self._get_links(html) sleep(30) except WebDriverException: self._create_exception_file(traceback.format_exc(), sub_dir) except KeyboardInterrupt: self._create_exception_file(traceback.format_exc(), sub_dir) finally: capture.kill() browser.close() return links