import httpx from typing import List, Dict, Any RECCOBEATS_API_URL = "https://api.reccobeats.com/v1/audio-features" class ReccoBeatsClient: async def get_audio_features(self, spotify_ids: List[str]) -> List[Dict[str, Any]]: if not spotify_ids: return [] ids_param = ",".join(spotify_ids) async with httpx.AsyncClient(timeout=30.0) as client: try: response = await client.get( RECCOBEATS_API_URL, params={"ids": ids_param} ) if response.status_code != 200: print(f"ReccoBeats API returned status {response.status_code}") return [] content = response.json().get("content", []) for item in content: href = item.get("href", "") if "spotify.com/track/" in href: spotify_id = href.split("/track/")[-1].split("?")[0] item["spotify_id"] = spotify_id return content except Exception as e: print(f"ReccoBeats API error: {e}") return []