import re
import glob
import random

html_files = glob.glob('/Applications/XAMPP/xamppfiles/htdocs/bus.online/*.html')

for filepath in html_files:
    with open(filepath, 'r') as f:
        content = f.read()
    
    def repl(match):
        return match.group(0).replace('random=1', f'random={random.randint(100, 9999)}')
    
    content = re.sub(r'https://picsum\.photos/[0-9]+/[0-9]+\?random=1', repl, content)
    
    with open(filepath, 'w') as f:
        f.write(content)

print("Randomized image URLs.")
