deedy5 / duckduckgo_search

Search for words, documents, images, videos, news, maps and text translation using the DuckDuckGo.com search engine. Downloading files and images to a local hard drive.
MIT License
937 stars 117 forks source link

DDGS how to set max_result like ddg() #74

Closed Undertone0809 closed 1 year ago

Undertone0809 commented 1 year ago

I wonder know DDGS().text() how to set max_results like ddg()

If I use ddg(),I can do as follows.

results = ddg("my query", max_result=5)

But I found DDGS might lose that ability. It can not use max_result parameter. Will max_result be provided for DDGS in the future?

armysarge commented 1 year ago

Having the same issue

deedy5 commented 1 year ago

The generator doesn't aggregate the data, it yields one at a time. That is, if I add this parameter again, it will just be a counter that will stop the generator when it gives the right number of results.

kinance commented 1 year ago

I migrated our code to new DDGS.text func and use islice to limit the max result for backward comp. In case any interest, please see https://github.com/Significant-Gravitas/Auto-GPT/pull/4383/files.

Undertone0809 commented 1 year ago

I migrated our code to new DDGS.text func and use islice to limit the max result for backward comp. In case any interest, please see https://github.com/Significant-Gravitas/Auto-GPT/pull/4383/files.

A good solution!