"""Audit type+raw returned by każdy active extractor."""
from app.extractors import try_extract

TESTS = [
    # Critical
    ("pornhatcom", "https://www.pornhat.com/video/rocking-logan-and-riley-s-pornohub-action/"),
    ("porn00org", "https://www.porn00.org/video/gia-derza-intense-rectal-gaping/"),
    ("pornxpph", "https://pornxp.ph/videos/73009503575"),
    # Aggregators with m3u8 risk
    ("latestpornvideocom", "https://latestpornvideo.com/777904/"),
    ("mypornerleakcom", "https://mypornerleak.com/mila-koi-gets-fucked-hard-by-brickzilla-bbc/"),
    ("perverzijacom", "https://tube.perverzija.com/bangbrosclips-peta-jensen-peta-jensen-daily-dick-fix/"),
    ("porndishcom", "https://www.porndish.com/porn/private-sata-jones-britney-dutch-milf-sata-jones-with-britney-dutch-in-an-anal-threesome/"),
    # VPS-blocked (WebView)
    ("xhamstercom", "https://xhamster.com/videos/brunette-mom-diana-prince-fucks-the-biggest-cock-shes-ever-seen-xhKGZTw"),
    ("porndittcom", "https://v.pornditt.com/videos/162604/allgirlmassage-charlotte-sins-addison-vodka-and-scarlett-bloom-wrb"),
    ("sxylandcom", "https://sxyland.com/22140/momswap-annie-king-and-kell-fire-one-pussy-forever-nah-lets-make-a-deal-wedding-day-swap/"),
    ("fpoxxx", "https://www.fpo.xxx/video/1168558/bang-for-a-buck-rocky-emerson/"),
    # Direct mp4 expected (safe)
    ("hqpornercom", "https://hqporner.com/hdporn/114981-if_no_one_else_is_coming---.html"),
    ("freshpornoorg", "https://freshporno.org/videos/a-caring-step-sister/"),
    ("epornercom", "https://www.eporner.com/video-HPQBR5TeKjv/annie-reiss-5k/"),
    ("sxyprncom", "https://sxyprn.com/post/68adbb3b6bf1b.html"),
    # yt-dlp mainstream
    ("pornhubcom", "https://pornhub.com/view_video.php?viewkey=68597f719a5db"),
    ("xvideoscom", "https://www.xvideos.com/video.ulklkike487/i_helped_my_stepbro_to_cum_with_my_hands_boobs_and_mouth_-_julia_goddess"),
    ("xnxxcom", "https://www.xnxx.com/video-5pc3of3/kimberly_kendall_and_jon_jon"),
    ("youporncom", "https://www.youporn.com/watch/17136141/matchmaker-bangs-milf-teen-she-matched"),
    ("redtubecom", "https://redtube.com/43048211"),
    ("porntrexcom", "https://www.porntrex.com/video/1626524/sidra-sage-viral-video"),
]
for sitetag, url in TESTS:
    print(f"=== {sitetag} ===")
    try:
        ss = try_extract(sitetag, url)
        types = [s.type for s in (ss or [])]
        flags = [s.raw for s in (ss or [])]
        # First link domain for diagnosis
        first = (ss or [None])[0]
        domain = ""
        if first and first.link:
            from urllib.parse import urlparse
            domain = urlparse(first.link).hostname or ""
        print(f"  count={len(ss or [])} types={types[:5]} first_domain={domain} flags={flags[:2]}")
    except Exception as e:
        print(f"  ERROR: {e}")
