File size: 891 Bytes
655b3af
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import time
import subprocess
import sys
import os

def run_scraper():
    print(f"\n[{time.strftime('%Y-%m-%d %H:%M:%S')}] Starting data aggregation...")
    try:
        # Run aggregator.py (Startups)
        subprocess.run([sys.executable, "aggregator.py"], check=True)
        # Run ai_training_scraper.py (AI Training)
        subprocess.run([sys.executable, "ai_training_scraper.py"], check=True)
        print(f"[{time.strftime('%Y-%m-%d %H:%M:%S')}] All scrapers ran successfully.")
    except Exception as e:
        print(f"[{time.strftime('%Y-%m-%d %H:%M:%S')}] Aggregation failed: {e}")

if __name__ == "__main__":
    print("Firstify Auto-Scheduler Started.")
    print("Interval: 60 minutes")
    
    # Run once immediately on start
    run_scraper()
    
    while True:
        # Wait for 60 minutes
        time.sleep(3600)
        run_scraper()