31 lines
1.2 KiB
Python
31 lines
1.2 KiB
Python
from pathlib import Path
|
|
import sqlite3
|
|
import pandas as pd
|
|
|
|
PROJECT_ROOT = Path(__file__).resolve().parent.parent
|
|
DB_PATH = PROJECT_ROOT / "data" / "hiffi_catalog.db"
|
|
|
|
conn = sqlite3.connect(DB_PATH)
|
|
query = """
|
|
SELECT
|
|
a.artist_id, a.artist_name, a.youtube_url,
|
|
t.subscribers_count, t.spotify_monthly_listeners
|
|
FROM artists a
|
|
JOIN telemetry_metrics t ON a.artist_id = t.artist_id
|
|
WHERE a.image_verified_flag = 1
|
|
"""
|
|
df = pd.read_sql_query(query, conn)
|
|
conn.close()
|
|
|
|
# Flag remaining search queries
|
|
still_search = df[df["youtube_url"].astype(str).str.contains(r"results\?search_query", regex=True, na=False)]
|
|
|
|
# Flag suspicious subscriber counts (< 5,000 subs for artists with > 200,000 Spotify listeners)
|
|
mismatched_subs = df[(df["spotify_monthly_listeners"] > 200000) & (df["subscribers_count"] < 5000)]
|
|
|
|
print(f"Remaining YouTube search fallback URLs: {len(still_search)}")
|
|
print(f"Flagged subscriber mismatches (< 5k subs with high Spotify reach): {len(mismatched_subs)}")
|
|
|
|
if not mismatched_subs.empty:
|
|
print("\nSuspicious channel mappings needing verified override:")
|
|
print(mismatched_subs[["artist_name", "subscribers_count", "spotify_monthly_listeners", "youtube_url"]].to_string(index=False)) |