SimpleSam commited on
Commit
8a9a981
·
verified ·
1 Parent(s): bebfbc6

Update tools/manyata.py

Browse files
Files changed (1) hide show
  1. tools/manyata.py +14 -1
tools/manyata.py CHANGED
@@ -16,7 +16,20 @@ def duckduckgo_search(query):
16
  results = []
17
  if data.get("AbstractText"):
18
  results.append({
19
- ""
 
 
20
  })
 
 
 
 
 
 
 
 
 
21
  except error:
 
 
22
 
 
16
  results = []
17
  if data.get("AbstractText"):
18
  results.append({
19
+ "title": data.get("Heading"),
20
+ "link": data.get("AbstractURL"),
21
+ "snippet": data.get("AbstractText")
22
  })
23
+ for topic in data.get("RelatedTopics", []):
24
+ if "Text" in topic and "FirstURL" in topic:
25
+ results.append({
26
+ "title": topic.get("Text"),
27
+ "link": topic.get("FirstURL"),
28
+ "snippet": topic.get("Text")
29
+ })
30
+ return results
31
+
32
  except error:
33
+ print(f"[manyata error] {error}")
34
+ return []
35