Open amacaqueru opened 1 year ago
sounds the lib https://github.com/deedy5/duckduckgo_search launched a break changing and the notebook will need to be refactored.
Duckduckgo_search Attention. Versions before v2.9.4 no longer work as of May 12, 2023!
I updated search_images() to match the latest version of duckduckgo_search and checked on google collab - everything is fine. PR #85
from itertools import islice
from duckduckgo_search import DDGS
from fastcore.all import *
def search_images(term, max_images=200):
with DDGS() as ddgs:
return [x['image'] for x in islice(ddgs.images(term), max_images)]
I get the following error while trying to download the forest photos
IndexError Traceback (most recent call last) in <cell line: 1>()
----> 1 download_url(search_images('forest photos', max_images=1)[0], 'forest.jpg', show_progress=False)
2 Image.open('forest.jpg').to_thumb(256,256)
1 frames /usr/local/lib/python3.10/dist-packages/fastcore/foundation.py in _get(self, i) 114 115 def _get(self, i): --> 116 if is_indexer(i) or isinstance(i,slice): return getattr(self.items,'iloc',self.items)[i] 117 i = mask2idxs(i) 118 return (self.items.iloc[list(i)] if hasattr(self.items,'iloc')
IndexError: list index out of range