H commited on
Commit
dde0d87
·
1 Parent(s): aa09acb

fix duckduckgo.py (#1497)

Browse files

### What problem does this PR solve?



### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)

Files changed (1) hide show
  1. graph/component/duckduckgo.py +2 -2
graph/component/duckduckgo.py CHANGED
@@ -46,12 +46,12 @@ class DuckDuckGo(ComponentBase, ABC):
46
  if not ans:
47
  return DuckDuckGo.be_output(self._param.no)
48
 
49
- if self.channel == "text":
50
  with DDGS() as ddgs:
51
  # {'title': '', 'href': '', 'body': ''}
52
  duck_res = [{"content": '<a href="' + i["href"] + '">' + i["title"] + '</a> ' + i["body"]} for i in
53
  ddgs.text(ans, max_results=self._param.top_n)]
54
- elif self.channel == "news":
55
  with DDGS() as ddgs:
56
  # {'date': '', 'title': '', 'body': '', 'url': '', 'image': '', 'source': ''}
57
  duck_res = [{"content": '<a href="' + i["url"] + '">' + i["title"] + '</a> ' + i["body"]} for i in
 
46
  if not ans:
47
  return DuckDuckGo.be_output(self._param.no)
48
 
49
+ if self._param.channel == "text":
50
  with DDGS() as ddgs:
51
  # {'title': '', 'href': '', 'body': ''}
52
  duck_res = [{"content": '<a href="' + i["href"] + '">' + i["title"] + '</a> ' + i["body"]} for i in
53
  ddgs.text(ans, max_results=self._param.top_n)]
54
+ elif self._param.channel == "news":
55
  with DDGS() as ddgs:
56
  # {'date': '', 'title': '', 'body': '', 'url': '', 'image': '', 'source': ''}
57
  duck_res = [{"content": '<a href="' + i["url"] + '">' + i["title"] + '</a> ' + i["body"]} for i in