import httpx from utils.logger import log async def fetch_txt_file(url) -> list[str]: try: async with httpx.AsyncClient() as client: r = await client.get(url, timeout=15.0) r.raise_for_status() lines = r.text.strip().splitlines() return [ line.strip().lstrip("@").lower() for line in lines if line.strip() and not line.strip().startswith("#") ] except Exception as e: log(f"Failed to fetch txt from {url}: {e}") return [] async def fetch_json_file(url) -> dict: try: async with httpx.AsyncClient() as client: r = await client.get(url, timeout=15.0) r.raise_for_status() return r.json() except Exception as e: log(f"Failed to fetch JSON from {url}: {e}") raise