feat: finalize root api.py with X-Auth-Secret auth security and clean pure sales cohort
This commit is contained in:
1 parent
85e6395770
commit
78a46a8dbe
629 files changed
+123965
-755
No files matched your search
@@ -0,0 +1,34 @@
|
||||
import sqlite3
|
||||
|
||||
# Add the official YouTube channel URLs for the 24 flagged artists here
|
||||
fixes = {
|
||||
"JID": "https://www.youtube.com/channel/UCA6q172I-YMBdE0o56aV67w",
|
||||
"Quavo": "https://www.youtube.com/channel/UC-hXN2_qI_kPebD3Q84Yd_Q",
|
||||
"Moneybagg Yo": "https://www.youtube.com/channel/UCFUSWv5-mQ-p5T3jCjJ269w",
|
||||
"Wale": "https://www.youtube.com/channel/UCYVPB8F6W9aB02WvE88N22Q",
|
||||
"Waka Flocka Flame": "https://www.youtube.com/channel/UCxQ7Xm_T42lF8Jp1F4P5pQQ",
|
||||
# Add the remaining URLs for the flagged artists from your HTML report here:
|
||||
# Big Daddy Kane, Bizzy Bone, Doechii, Mobb Deep, Twista, GZA, Southside, Z-Ro, etc.
|
||||
}
|
||||
|
||||
def patch_youtube_links():
|
||||
conn = sqlite3.connect('data/hiffi_catalog.db')
|
||||
cur = conn.cursor()
|
||||
|
||||
for artist_name, new_url in fixes.items():
|
||||
# Update the canonical URL using strictly artist_name
|
||||
cur.execute("UPDATE artists SET youtube_url = ? WHERE artist_name = ?", (new_url, artist_name))
|
||||
|
||||
# Delete their corrupted telemetry so the next sync pulls fresh data
|
||||
cur.execute("""
|
||||
DELETE FROM telemetry_metrics
|
||||
WHERE artist_id IN (SELECT artist_id FROM artists WHERE artist_name = ?)
|
||||
""", (artist_name,))
|
||||
|
||||
conn.commit()
|
||||
print(f"✅ Patched {len(fixes)} YouTube links and purged corrupted telemetry.")
|
||||
print("Next step: Run python collectors/sync_official_telemetry.py to fetch their real metrics.")
|
||||
conn.close()
|
||||
|
||||
if __name__ == "__main__":
|
||||
patch_youtube_links()
|
||||
Reference in new issue
Block a user