Harrison/fix memory and serp (#457)

Co-authored-by: Bruno Bornsztein <bruno.bornsztein@gmail.com>
This commit is contained in:
Harrison Chase
2022-12-28 11:07:57 -05:00
committed by GitHub
parent d98607408b
commit 2b84e5cda3
4 changed files with 54 additions and 52 deletions

View File

@@ -90,8 +90,6 @@ class SerpAPIWrapper(BaseModel):
and "snippet_highlighted_words" in res["answer_box"].keys()
):
toret = res["answer_box"]["snippet_highlighted_words"][0]
elif "snippet" in res["organic_results"][0].keys():
toret = res["organic_results"][0]["snippet"]
elif (
"sports_results" in res.keys()
and "game_spotlight" in res["sports_results"].keys()
@@ -102,6 +100,9 @@ class SerpAPIWrapper(BaseModel):
and "description" in res["knowledge_graph"].keys()
):
toret = res["knowledge_graph"]["description"]
elif "snippet" in res["organic_results"][0].keys():
toret = res["organic_results"][0]["snippet"]
else:
toret = "No good search result found"
return toret