Closed KirillRepinArt closed 1 year ago
You should update version to v2.9.4
pip install -U duckduckgo_search
All previous versions no longer work.
I have tried that also multiple times. It might work for a moment, but on the next run I'm getting this:
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
Cell In[3], line 2
1 urls = search_images('airplane photos', max_images=1)
----> 2 urls[0]
File F:\Program Files (x86)\Python_3_10_6\lib\site-packages\fastcore\foundation.py:112, in L.__getitem__(self, idx)
--> 112 def __getitem__(self, idx): return self._get(idx) if is_indexer(idx) else L(self._get(idx), use_list=None)
File F:\Program Files (x86)\Python_3_10_6\lib\site-packages\fastcore\foundation.py:116, in L._get(self, i)
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')
119 else self.items.__array__()[(i,)] if hasattr(self.items,'__array__')
120 else [self.items[i_] for i_ in i])
IndexError: list index out of range
Problem started today, yesterday everything worked fine all day.
ddgs version
Type this command in the terminal and show me the result.
ddgs version
Type this command in the terminal and show me the result.
F:\Jupyter>ddgs version 2.9.4 Would prefer a screenshot?
What about ddgs images -k 'airplane photos'
?
Using terminal?
The following is from cmd:
F:\Jupyter>ddgs images -k 'airplane photos'
Usage: ddgs [OPTIONS] COMMAND1 [ARGS]... [COMMAND2 [ARGS]...]...
Try 'ddgs --help' for help.
Error: No such command "photos'".
F:\Jupyter>
I've triedddgs images -k 'airplane photos'
now using Windows PowerShell and it seems to work:
PS F:\jupyter> ddgs version
2.9.4
PS F:\jupyter> ddgs images -k 'airplane photos'
1. ------------------------------------------------------------------------------
title 50 Airplane Wallpaper Backgrounds in HD for Free Download
image http://wonderfulengineering.com/wp-content/uploads/2014/05/airplane-wallpaper-1.jpg
thumbnail https://tse3.mm.bing.net/th?id=OIP.CSU0WYkZwY4keDZCuzMsfQHaE5&pid=Api
url https://wonderfulengineering.com/50-airplane-wallpaper-backgrounds-in-hd-for-free-download/
height 3687
width 5582
source Bing
It's not a problem with this package.
It's not a problem with this package.
Is it possible that there are some changes regarding user's IP address? If I change my IP I'm able to execute my code and it downloads several images until it stops, then I have to change my IP address again. There seem to be a limit on the amount of requests I can send from the same IP.
If you have python 3.7, upgrade duckduckgo_search to v2.9.5. Maybe that's the problem.
I'm using Python 3.10.
That's very unfortunate that it seem to break over the nigh. I tried this example in notebook:
from duckduckgo_search import ddg_images
keywords = 'liberty tree'
r = ddg_images(keywords, region='wt-wt', safesearch='Off', size=None,
color='Monochrome', type_image=None, layout=None, license_image=None, max_results=300)
print(r)
it returns only []
Again, it seems that I can have very few requests in a given amount of time and then it cuts me off. But may be it's just me, I'll have to try something else.
Try to use a proxy
While running this:
I'm getting this:
IndexError Traceback (most recent call last) Cell In[2], line 2 1 urls = search_images('birds', max_images=5) ----> 2 urls[0]
File F:\Program Files (x86)\Python_3_10_6\lib\site-packages\fastcore\foundation.py:112, in L.getitem(self, idx) --> 112 def getitem(self, idx): return self._get(idx) if is_indexer(idx) else L(self._get(idx), use_list=None)
File F:\Program Files (x86)\Python_3_10_6\lib\site-packages\fastcore\foundation.py:116, in L._get(self, i) 115 def _get(self, i): --> 116 if isindexer(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') 119 else self.items.array()[(i,)] if hasattr(self.items,'array') 120 else [self.items[i] for i_ in i])
IndexError: list index out of range
Yesterday everything worked fine but to day I encounter this issue, I've tried different versions of duckduckgo_search, it might work for a bit but then it breaks again.