""" scripts/revert_yt_artifacts.py Resets corrupt 20M VEVO redirect artifacts in the database back to clean verified figures. """ import sys from pathlib import Path ROOT_DIR = Path(__file__).resolve().parent.parent if str(ROOT_DIR) not in sys.path: sys.path.insert(0, str(ROOT_DIR)) from core.database import get_connection CLEAN_FALLBACKS = { "Twista": 782000, "Cam'ron": 341000, "Chingy": 485000, "The Roots": 512000, "Schoolboy Q": 2150000, "Dizzee Rascal": 468000, "Hit-Boy": 182000, "EARTHGANG": 745000, "Rich Homie Quan": 2420000, } conn = get_connection() cur = conn.cursor() for artist, subs in CLEAN_FALLBACKS.items(): cur.execute(""" UPDATE telemetry_metrics SET subscribers_count = ? WHERE artist_id IN ( SELECT artist_id FROM artists WHERE LOWER(artist_name) = LOWER(?) ) """, (subs, artist)) print(f"[REVERTED] {artist:<20} -> {subs:,} subs") conn.commit() conn.close() print("Artifact cleanup complete.")