api: Fix error parsing sc site

This commit is contained in:
Lovi 2025-03-11 21:40:08 +01:00
parent 060a96e657
commit 89deb6c283

View File

@ -64,8 +64,15 @@ def title_search(title_search: str) -> int:
# Prepara le scelte per l'utente
if site_constant.TELEGRAM_BOT:
choices = []
for i, dict_title in enumerate(response.json()['data']):
# Collect json data
try:
data = response.json().get('data', [])
except Exception as e:
console.log(f"Error parsing JSON response: {e}")
return 0
for i, dict_title in enumerate(data):
try:
media_search_manager.add_media({
'id': dict_title.get('id'),