#!/usr/bin/env python3
"""Probe candidate content-region selectors on both saved pages."""
from bs4 import BeautifulSoup

def load(f):
    return BeautifulSoup(open(f, encoding='utf-8', errors='replace').read(), 'lxml')

def stats(node):
    if not node:
        return "not found"
    n = BeautifulSoup(str(node), 'lxml')
    for t in n(['script', 'style', 'noscript']):
        t.decompose()
    text = ' '.join(n.get_text(' ', strip=True).split())
    return f"text={len(text)}ch  imgs={len(n.find_all('img'))}  links={len(n.find_all('a'))}"

probes = [
    ('WP',   'wp_wb.html',   ['main', '.content-container', '.content-wrap', '.entry-content', 'article', '#main']),
    ('LIVE', 'live_wb.html', ['#main', '#content-container', '#content', 'main', 'article', '.page-content']),
]
for name, f, sels in probes:
    s = load(f)
    print(f"== {name} ({f}) ==")
    for sel in sels:
        print(f"  {sel:18} -> {stats(s.select_one(sel))}")
    print()
