#!/bin/bash

# Find CSS Selector Helper
# This script helps you find the right CSS selector for monitoring

URL="$1"

if [ -z "$URL" ]; then
    echo "Find CSS Selector Helper"
    echo "========================"
    echo ""
    echo "Usage: $0 <URL>"
    echo ""
    echo "Example:"
    echo "  $0 https://fcim.utm.md/procesul-de-studii/orar/"
    echo ""
    exit 1
fi

echo "Downloading page from: $URL"
echo ""

# Download and analyze
curl -s "$URL" | grep -i "href\|schedule\|download\|pdf\|link" | head -20

echo ""
echo "========================================"
echo "Common selectors to try:"
echo "========================================"
echo ""
echo "  a                    - any link"
echo "  a.link               - link with class 'link'"
echo "  a#download           - link with id 'download'"
echo "  .schedule-link       - element with class 'schedule-link'"
echo "  .btn-download        - element with class 'btn-download'"
echo "  [href*='.pdf']       - any link containing .pdf"
echo ""
echo "Open page in browser with F12 (Developer Tools)"
echo "and look for HTML elements containing the link you want to monitor."
echo ""
