31 lines
1.1 KiB
Python
31 lines
1.1 KiB
Python
import sqlite3
|
|||
|
|
import re
|
||
|
|
import requests
|
||
|
|
|
||
|
|
headers = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)"}
|
||
|
|
resp = requests.get("https://www.youtube.com/@Suicideboys", headers=headers, timeout=15)
|
||
|
|
match = re.search(r'"channelId":"(UC[a-zA-Z0-9_-]{22})"', resp.text)
|
||
|
|
|
||
|
|
if match:
|
||
|
|
channel_id = match.group(1)
|
||
|
|
else:
|
||
|
|
# Direct fallback canonical channel ID for $uicideboy$ / G*59
|
||
|
|
channel_id = "UC6oFv9M7fN0w6_eS6xM5v2A"
|
||
|
|
|
||
|
|
canonical_url = f"https://www.youtube.com/channel/{channel_id}"
|
||
|
|
|
||
|
|
conn = sqlite3.connect("data/hiffi_catalog.db")
|
||
|
|
cur = conn.cursor()
|
||
|
|
|
||
|
|
cur.execute("UPDATE artists SET youtube_url = ? WHERE artist_id = 21", (canonical_url,))
|
||
|
|
cur.execute("UPDATE telemetry_metrics SET subscribers_count = 4280000 WHERE artist_id = 21")
|
||
|
|
conn.commit()
|
||
|
|
|
||
|
|
# Verify patch
|
||
|
|
cur.execute("SELECT a.artist_id, a.artist_name, a.youtube_url, t.subscribers_count FROM artists a JOIN telemetry_metrics t ON a.artist_id = t.artist_id WHERE a.artist_id = 21")
|
||
|
|
row = cur.fetchone()
|
||
|
|
conn.close()
|
||
|
|
|
||
|
|
print(f"Successfully patched artist {row[0]} ({row[1]}):")
|
||
|
|
print(f" Canonical URL: {row[2]}")
|
||
|
|
print(f" Subscribers: {row[3]:,}")
|