diff --git a/app/app.py b/app/app.py index 61ff12b..1c486c7 100644 --- a/app/app.py +++ b/app/app.py @@ -443,8 +443,8 @@ async def search_torrent_by_id(torrent_id: str) -> dict: print(f"Warning: No hash found and no valid magnet link. Hash: {hash_value}, Magnet: {result.get('Magnet', 'None')[:50]}") magnet = "" - # Пробуем локальный torapi-qbit если хэш пустой - if not hash_value or not magnet or 'urn:btih:' not in magnet or len(magnet) < 30: + # Пробуем локальный torapi-qbit если хэш пустой или битый + if not hash_value or not re.search(r'urn:btih:([a-fA-F0-9]{40}|[a-zA-Z0-9]{32})', magnet): try: torapi_add_url = os.getenv("TORAPI_ADD_URL", "http://localhost:8444") fb_resp = await client.get(