Alternatives to Bing image search

Hi, my azure key expired after a week, and I don’t have a credit card. Does anyone know how to obtain datasets and continue working? I spend a good chunk of time searching online, but couldn’t find anything useful.

7 Likes

Should have searched the forum first :wink:

3 Likes

Thank you so much. I’ll remember to search the forum first next time :smiley:

1 Like

I did through a modified
google_images_download :
pip install git+https://github.com/Joeclinton1/google-images-download.git

next :
from google_images_download import google_images_download #importing the library

response = google_images_download.googleimagesdownload() #class instantiation

arguments = {“keywords”:“titmouse bird,nightingale,sparrow”,“limit”:100,“print_urls”:True} #creating list of arguments

paths = response.download(arguments) #passing the arguments to the function

print(paths) #printing absolute paths of the downloaded images

can anyone suggest how to use this further in 02_production.ipynb ?how to correctly replace instead of
results = search_images_bing(key, f’{o} bear’) ?

I’ve made a simple module/file you can run in terminal with your parameters (keyword and #of desired pics). It does require Chrome, ChromeDriver and Selenium.

You can find it here:

1 Like

Wow! This worked perfectly without needing to go through the painful process of creating azure account for creating bing api keys. Thanks a ton!

I’m getting this error:

---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
Cell In[6], line 1
----> 1 duckduckgo_search(root, "Cats", "cute kittens", max_results=100) 

File /opt/conda/lib/python3.10/site-packages/jmd_imagescraper/core.py:211, in duckduckgo_search(path, label, keywords, max_results, img_size, img_type, img_layout, img_color, uuid_names)
    208 '''Run a DuckDuckGo search and download the images. Returns a list of Path objects for files downloaded to disc.'''
    210 print("Duckduckgo search:", keywords)
--> 211 links = duckduckgo_scrape_urls(keywords, max_results, img_size, img_type, img_layout, img_color)
    212 return download_urls(Path(path)/label, links, uuid_names=uuid_names)

File /opt/conda/lib/python3.10/site-packages/jmd_imagescraper/core.py:82, in duckduckgo_scrape_urls(keywords, max_results, img_size, img_type, img_layout, img_color)
     80 resp = requests.post(BASE_URL, data=params)
     81 match = re.search(r'vqd=([\d-]+)\&', resp.text, re.M|re.I)
---> 82 assert match is not None, "Failed to obtain search token"
     84 HEADERS = {
     85     'authority': 'duckduckgo.com',
     86     'accept': 'application/json, text/javascript, */*; q=0.01',
   (...)
     93     'accept-language': 'en-US,en;q=0.9',
     94 }
     96 filters = ""

AssertionError: Failed to obtain search token

And I’m stuck on the solution. Does anyone have an idea for a solution?