mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-03-20 03:57:30 +08:00
Fix generator handling and update error message to reference requirements.in
Co-authored-by: jxxghp <51039935+jxxghp@users.noreply.github.com>
This commit is contained in:
@@ -115,10 +115,10 @@ class SearchWebTool(MoviePilotTool):
|
|||||||
|
|
||||||
with DDGS(**ddgs_kwargs) as ddgs:
|
with DDGS(**ddgs_kwargs) as ddgs:
|
||||||
# 使用 text 方法进行搜索
|
# 使用 text 方法进行搜索
|
||||||
search_results = ddgs.text(
|
search_results = list(ddgs.text(
|
||||||
keywords=query,
|
keywords=query,
|
||||||
max_results=max_results
|
max_results=max_results
|
||||||
)
|
))
|
||||||
|
|
||||||
for result in search_results:
|
for result in search_results:
|
||||||
results.append({
|
results.append({
|
||||||
@@ -140,7 +140,7 @@ class SearchWebTool(MoviePilotTool):
|
|||||||
return results
|
return results
|
||||||
|
|
||||||
except ImportError:
|
except ImportError:
|
||||||
logger.error("duckduckgo-search 库未安装,请运行: pip install duckduckgo-search")
|
logger.error("duckduckgo-search 库未安装,请在 requirements.in 中添加依赖后重新构建")
|
||||||
return []
|
return []
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warning(f"DuckDuckGo 搜索失败: {e}")
|
logger.warning(f"DuckDuckGo 搜索失败: {e}")
|
||||||
|
|||||||
Reference in New Issue
Block a user