Skip to content

Commit

Permalink
v1.0
Browse files Browse the repository at this point in the history
added text normalization to the ddg() function
  • Loading branch information
deedy5 authored Feb 1, 2022
1 parent b3492e1 commit 6b1c0e5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions duckduckgo_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,12 @@ def ddg(keywords, region='wt-wt', safesearch='Moderate', time=None, max_results=
except:
if r['u'] not in cache:
cache.add(r['u'])
body = html.fromstring(r['a'])
body = html.tostring(body, method='text', encoding='unicode')
results.append({
'title': r['t'],
'title': html.fromstring(r['t']).text,
'href': r['u'],
'body': r['a'],
'body': body,
})
sleep(0.75)

Expand Down

0 comments on commit 6b1c0e5

Please sign in to comment.