import xml.etree.ElementTree as ET from datetime import datetime, timezone def parse_forum(filepath, forum_name): tree = ET.parse(filepath) root = tree.getroot() forum_title = root.get('title', forum_name) print(f"\n=== {forum_title} (Recent threads) ===") count = 0 for thread in root.findall('.//thread'): subject = thread.get('subject', '') author = thread.get('author', '') articles = thread.get('numarticles', '0') lastpost = thread.get('lastpostdate', '') postdate = thread.get('postdate', '') # Check if recent (June 2026) try: dt = datetime.strptime(lastpost[:25], '%a, %d %b %Y %H:%M:%S') dt = dt.replace(tzinfo=timezone.utc) now = datetime.now(timezone.utc) days_ago = (now - dt).days except: days_ago = 999 if days_ago <= 30: # Last 30 days count += 1 if count <= 10: print(f" [{lastpost[:16]}] {subject} (by {author}, {articles} posts, {days_ago}d ago)") for forum_file, name in [ ("/home/hermes/workspace/bgg-scrape/forum25.xml", "Articles & Blogs"), ("/home/hermes/workspace/bgg-scrape/forum30.xml", "Videos & Podcasts"), ("/home/hermes/workspace/bgg-scrape/forum26.xml", "Board Game Design"), ]: parse_forum(forum_file, name)