-- Delisting hdporn92 2026-05-18: SEO shell scrape, no actual video.
-- Scene pages have zero player iframe (only happyleafmotion ads), JS hijacks all
-- anchor clicks → go.rmishe.com/smartpop/... popunder redirect. Mobile WebView
-- page-as-hoster shows ad redirect instead of video.

BEGIN;

CREATE TEMP TABLE _hd92_solo AS
SELECT s.id AS scene_id
FROM scenes s
WHERE EXISTS (
  SELECT 1 FROM playback_sources ps
  WHERE ps.scene_id = s.id AND ps.origin = 'tube:hdporn92com' AND ps.dead_at IS NULL
)
AND NOT EXISTS (
  SELECT 1 FROM playback_sources ps2
  WHERE ps2.scene_id = s.id AND ps2.origin <> 'tube:hdporn92com' AND ps2.dead_at IS NULL
);

SELECT COUNT(*) AS solo_to_delete FROM _hd92_solo;

UPDATE playback_sources
SET dead_at = NOW(),
    dead_reason = 'SEO shell - no player iframe, ad redirect (delisted 2026-05-18)'
WHERE origin = 'tube:hdporn92com' AND dead_at IS NULL;

DELETE FROM scene_tags WHERE scene_id IN (SELECT scene_id FROM _hd92_solo);
DELETE FROM scene_performers WHERE scene_id IN (SELECT scene_id FROM _hd92_solo);
DELETE FROM favorite_scenes WHERE scene_id IN (SELECT scene_id FROM _hd92_solo);
DELETE FROM scene_play_progress WHERE scene_id IN (SELECT scene_id FROM _hd92_solo);
DELETE FROM scene_fingerprints WHERE scene_id IN (SELECT scene_id FROM _hd92_solo);
DELETE FROM scene_external_refs WHERE scene_id IN (SELECT scene_id FROM _hd92_solo);
DELETE FROM playback_sources WHERE scene_id IN (SELECT scene_id FROM _hd92_solo);
DELETE FROM scenes WHERE id IN (SELECT scene_id FROM _hd92_solo);

COMMIT;

SELECT
  COUNT(*) FILTER (WHERE dead_at IS NULL) AS live_remaining,
  COUNT(*) FILTER (WHERE dead_at IS NOT NULL) AS dead_total
FROM playback_sources
WHERE origin = 'tube:hdporn92com';
