File size: 355 Bytes
cc93c47
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
from duckduckgo_search import DDGS


def duckduckgo_search(query, max_search_result=3):
    with DDGS() as ddgs:
        responses = list()
        for i, r in enumerate(ddgs.text(query, region='wt-wt', safesearch='off', timelimit='y')):
            if i == max_search_result:
                break
            responses.append(r)
        return responses