Spaces:
Runtime error
Runtime error
Commit ·
11a7944
1
Parent(s): ade459f
Fix YaCy function indentation completely
Browse files- whoogle_search.py +10 -10
whoogle_search.py
CHANGED
|
@@ -154,16 +154,16 @@ def yacy_search(query: str, max_results: int = 10, yacy_url: Optional[str] = Non
|
|
| 154 |
}
|
| 155 |
|
| 156 |
with httpx.Client(timeout=20.0, follow_redirects=True) as client:
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
for chunk in chunks:
|
| 168 |
try:
|
| 169 |
url = chunk.get('link', '')
|
|
|
|
| 154 |
}
|
| 155 |
|
| 156 |
with httpx.Client(timeout=20.0, follow_redirects=True) as client:
|
| 157 |
+
response = client.get(api_url, params=params)
|
| 158 |
+
response.raise_for_status()
|
| 159 |
+
|
| 160 |
+
data = response.json()
|
| 161 |
+
results = []
|
| 162 |
+
seen_urls = set()
|
| 163 |
+
|
| 164 |
+
# YaCy returns JSON
|
| 165 |
+
chunks = data.get('channels', [{}])[0].get('items', [])
|
| 166 |
+
|
| 167 |
for chunk in chunks:
|
| 168 |
try:
|
| 169 |
url = chunk.get('link', '')
|