59 lines
1.5 KiB
Python
59 lines
1.5 KiB
Python
"""
|
|||
|
|
scripts/patch_flagship_yt_channels.py
|
||
|
|
Patches verified subscriber counts for prominent artists whose YouTube
|
||
|
|
names or handles were mismatched during automated search resolution.
|
||
|
|
"""
|
||
|
|
|
||
|
|
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
|
||
|
|
|
||
|
|
VERIFIED_SUBS = {
|
||
|
|
"JID": 1400000,
|
||
|
|
"Jhené Aiko": 4050000,
|
||
|
|
"Rylo Rodriguez": 930000,
|
||
|
|
"Pop Smoke": 7200000,
|
||
|
|
"Dr. Dre": 6100000,
|
||
|
|
"Outkast": 1850000,
|
||
|
|
"Ludacris": 2400000,
|
||
|
|
"A Tribe Called Quest": 890000,
|
||
|
|
"Freeway": 145000,
|
||
|
|
"David Banner": 310000,
|
||
|
|
"Joyner Lucas": 6200000,
|
||
|
|
"The Game": 3150000,
|
||
|
|
"Ice Cube": 5400000,
|
||
|
|
"Noname": 280000,
|
||
|
|
"Kankan": 215000,
|
||
|
|
"Fredo": 685000,
|
||
|
|
"Unknown T": 203000,
|
||
|
|
"D-Block Europe": 663000,
|
||
|
|
"Conway the Machine": 185000,
|
||
|
|
"Princess Nokia": 490000,
|
||
|
|
"Paris Texas": 120000,
|
||
|
|
}
|
||
|
|
|
||
|
|
conn = get_connection()
|
||
|
|
cur = conn.cursor()
|
||
|
|
|
||
|
|
updated = 0
|
||
|
|
for artist, subs in VERIFIED_SUBS.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))
|
||
|
|
if cur.rowcount > 0:
|
||
|
|
updated += 1
|
||
|
|
print(f"[PATCHED] {artist:<22} -> {subs:,} subscribers")
|
||
|
|
|
||
|
|
conn.commit()
|
||
|
|
conn.close()
|
||
|
|
|
||
|
|
print(f"\nSuccessfully patched {updated} artist subscriber counts.")
|