Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -21,7 +21,14 @@ def search():
|
|
| 21 |
try:
|
| 22 |
with WEBS() as webs:
|
| 23 |
results = webs.text(keywords=q, region=region, safesearch=safesearch, backend=backend, max_results=max_results)
|
| 24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
except Exception as e:
|
| 26 |
return {"error": f"Error during search: {e}"}
|
| 27 |
|
|
|
|
| 21 |
try:
|
| 22 |
with WEBS() as webs:
|
| 23 |
results = webs.text(keywords=q, region=region, safesearch=safesearch, backend=backend, max_results=max_results)
|
| 24 |
+
# Extract the data you want to display (adjust based on webscout's structure)
|
| 25 |
+
search_results = [
|
| 26 |
+
{
|
| 27 |
+
'title': result.title,
|
| 28 |
+
'description': result.description
|
| 29 |
+
} for result in results
|
| 30 |
+
]
|
| 31 |
+
return search_results # Return the extracted data
|
| 32 |
except Exception as e:
|
| 33 |
return {"error": f"Error during search: {e}"}
|
| 34 |
|