Merge pull request #236 from bellingcat/cleanup_fixes

Cleanup fixes
This commit is contained in:
Erin Clark
2025-03-07 15:37:05 +00:00
committed by GitHub
2 changed files with 3 additions and 2 deletions

View File

@@ -303,11 +303,12 @@ class ArchivingOrchestrator:
if module in invalid_modules:
continue
loaded_module = None
try:
loaded_module: BaseModule = self.module_factory.get_module(module, self.config)
except (KeyboardInterrupt, Exception) as e:
logger.error(f"Error during setup of modules: {e}\n{traceback.format_exc()}")
if module_type == 'extractor' and loaded_module.name == module:
if loaded_module and module_type == 'extractor':
loaded_module.cleanup()
raise e

View File

@@ -104,7 +104,7 @@ class InstagramTbotExtractor(Extractor):
message = ""
time.sleep(3)
# media is added before text by the bot so it can be used as a stop-logic mechanism
while attempts < (self.timeout - 3) and (not message or not len(seen_media)):
while attempts < max(self.timeout - 3, 3) and (not message or not len(seen_media)):
attempts += 1
time.sleep(1)
for post in self.client.iter_messages(chat, min_id=since_id):