#!/bin/bash
# Extract all hotness items
xml_file="/home/hermes/workspace/bgg-scrape/hotness_full.xml"

echo "=== BGG Hotness List ==="
grep -oP '<item[^>]*>' "$xml_file" | while read line; do
  id=$(echo "$line" | grep -oP 'id="\K[^"]+')
  rank=$(echo "$line" | grep -oP 'rank="\K[^"]+')
  name=$(echo "$line" | grep -oP '<name value="\K[^"]+' | head -1)
  year=$(echo "$line" | grep -oP '<yearpublished value="\K[^"]+' | head -1)
  thumbnail=$(echo "$line" | grep -oP '<thumbnail value="\K[^"]+' | head -1)
  echo "Rank $rank: $name (ID:$id, Year:$year)"
done | head -30
