Files
hiffi-artist-intelligence/scripts/revert_yt_artifacts.py
T
Srilekha 78a46a8dbe
HIFFI Multi-Platform CI / test (3.12) (push) Successful in 50s
HIFFI Multi-Platform CI / test (3.11) (push) Successful in 50s
feat: finalize root api.py with X-Auth-Secret auth security and clean pure sales cohort
2026-11-04 16:49:39 +05:30

42 lines
1022 B
Python

"""
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.")